User Tools

Site Tools


aws:aws-deploy_cloudformation_from_cli

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

aws:aws-deploy_cloudformation_from_cli [15/02/2024 10:09] – created - external edit 127.0.0.1aws:aws-deploy_cloudformation_from_cli [30/05/2025 09:44] (current) – removed andrew
Line 1: Line 1:
-====== Deploy CloudFormation from cli ====== 
- 
-This bash script uses aws cli to deploy a stack compared to using the web GUI to create a stack. Main advantage is for automation and repeatability:- 
- 
-<code bash> 
-#!/bin/bash 
-#Written Andrew Stringer 01/03/2021 
-#Purpose to deploy a cloudformation stack from the cli. 
- 
-STACK_NAME='mystack-a' 
-TEMPLATE_BODY='file://mystack-a.yaml' 
-REGION='eu-west-1' 
-PROFILE=$1 
- 
-TAGS="Key=Name,Value=${STACK_NAME} Key=Build_Method,Value=CloudFormation Key=CostCentre,Value=12345 Key=Owner,Value=MY_ADMIN" 
- 
-echo "Using ${PROFILE}." 
- 
-#Test $1 exists 
-if [ -z "$PROFILE" ]; then 
-        echo "Your AWS Profile is not set, using default" 
-        PROFILE=default 
-fi 
- 
-# Who are we? 
-aws sts get-caller-identity --profile ${PROFILE} 
- 
-# Deploy the stack 
-aws cloudformation update-stack --stack-name ${STACK_NAME} --template-body ${TEMPLATE_BODY} --region ${REGION} --profile ${PROFILE} --capabilities CAPABILITY_NAMED_IAM --tags ${TAGS} 
- 
-</code> 
  
aws/aws-deploy_cloudformation_from_cli.1707991761.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki