Skip to content

Instantly share code, notes, and snippets.

@NicolasRitouet
Forked from ianblenke/Makefile
Last active November 30, 2016 08:45
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 NicolasRitouet/3fa8483528b70980483f0585d6d106d9 to your computer and use it in GitHub Desktop.
Save NicolasRitouet/3fa8483528b70980483f0585d6d106d9 to your computer and use it in GitHub Desktop.
A Makefile for creating, updating, watching, and deleting a CloudFormation VPC as per gists 9f4b8dd2b39c7d1c31ef and 0a6a6f26d1ecaa0d81eb
STACK:=myapp-dev
TEMPLATE:=cloudformation-template_vpc-iam.yml
PARAMETERS:=cloudformation-parameters_myapp-dev.yml
AWS_REGION:=eu-west-1
AWS_PROFILE:=aws-dev
all:
@which aws || pip install awscli
aws cloudformation create-stack --stack-name $(STACK) --template-body file://`pwd`/$(TEMPLATE) --parameters file://`pwd`/$(PARAMETERS) --capabilities CAPABILITY_IAM --profile $(AWS_PROFILE) --region $(AWS_REGION)
update:
aws cloudformation update-stack --stack-name $(STACK) --template-body file://`pwd`/$(TEMPLATE) --parameters file://`pwd`/$(PARAMETERS) --capabilities CAPABILITY_IAM --profile $(AWS_PROFILE) --region $(AWS_REGION)
events:
aws cloudformation describe-stack-events --stack-name $(STACK) --profile $(AWS_PROFILE) --region $(AWS_REGION)
watch:
watch --interval 10 "bash -c 'make events | head -25'"
output:
@which jq || ( which brew && brew install jq || which apt-get && apt-get install jq || which yum && yum install jq || which choco && choco install jq)
aws cloudformation describe-stacks --stack-name $(STACK) --profile $(AWS_PROFILE) --region $(AWS_REGION) | jq -r '.Stacks[].Outputs'
delete:
aws cloudformation delete-stack --stack-name $(STACK) --profile $(AWS_PROFILE) --region $(AWS_REGION)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment