Skip to content

Instantly share code, notes, and snippets.

@jeffbrl
Last active November 9, 2018 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffbrl/5a9ddc5ca86199d78b3964be1333c170 to your computer and use it in GitHub Desktop.
Save jeffbrl/5a9ddc5ca86199d78b3964be1333c170 to your computer and use it in GitHub Desktop.
AWS CloudFormation aliases collection
cvt =
!f() {
aws cloudformation validate-template --template-body file://"${1}"
}; f
dse =
!f() {
aws cloudformation describe-stack-events --stack-name "${1}" --query 'StackEvents[].[LogicalResourceId,ResourceStatus]' --output table
}; f
instances =
!f() {
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[Tags[?Key==`Name`].Value|[0],State.Name,Pri
vateIpAddress,PublicIpAddress]' --output table
}; f
active-stacks =
!f() {
aws cloudformation list-stacks --region us-east-1 --query 'StackSummaries[?starts_with(StackStatus, `DELETE_COMPLETE`) != `true`].[StackName,StackStatus]' --output table
}; f

Add the lines in the alias file to ~/.aws/cli/alias. These will take effect immediately.

cvt - validates template on local disk

dse - describe stack events; prints nice table with logical nresources with associated status

instances - list table of EC2 instances including Name tag, status, and IP addresses

active-stacks - list of stack names that are not in DELETE_COMPLETED. The name is a bit of a misnomer. Change it to something to is logical to you.

From your friends at Konekti Systems LLC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment