-
-
Save codevally/24559b3d77dbaf6f9452a5e7dd592851 to your computer and use it in GitHub Desktop.
aws create and update stack script; aws; cloudformation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $GitUserEmail ] || [ -z $GitAccessToken || [-z $CommunicatorApiKey] ; | |
then | |
echo "Environment Variables missing. Did you run int_env.sh?"; | |
exit; | |
fi | |
echo "You have 10 seconds to stop stack creation..." | |
#sleep 10 | |
echo "Starting stack creation..." | |
TEMPLATE_FILE='https://s3.amazonaws.com/mycompany/myproject/main.template' | |
S3_TEMPLATE_FILE='https://s3.amazonaws.com/mycompany/myproject/s3.template' | |
aws cloudformation create-stack --stack-name BLEED-myproject \ | |
--template-url $TEMPLATE_FILE \ | |
--capabilities CAPABILITY_IAM \ | |
--parameters \ | |
"ParameterKey"="VersionParameter","ParameterValue"="v1" \ | |
"ParameterKey"="ServiceNameParameter","ParameterValue"="myproject" \ | |
"ParameterKey"="EnvNameParameter","ParameterValue"="bleed" \ | |
"ParameterKey"="SubnetsParameter","ParameterValue"="'subnet-8e443ca4'" \ | |
"ParameterKey"="VPCIdParameter","ParameterValue"="vpc-7003d217" \ | |
"ParameterKey"="SSHBastionSecurityGroup","ParameterValue"="sg-db9724a0" \ | |
"ParameterKey"="KeyNameParameter","ParameterValue"="sonu-dev" \ | |
"ParameterKey"="RouterSecurityGroupParameter","ParameterValue"="sg-8d93edf6" \ | |
"ParameterKey"="GitUserEmailParameter","ParameterValue"="$GitUserEmail" \ | |
"ParameterKey"="GitAccessTokenParameter","ParameterValue"="$GitAccessToken" \ | |
"ParameterKey"="CommunicatorApiKeyParameter","ParameterValue"="$CommunicatorApiKey" \ | |
"ParameterKey"="DomainNameParameter","ParameterValue"="practodev.com" | |
echo "Creating s3 bucketsupdate in southeast-1 ..." | |
aws cloudformation create-stack --region "ap-southeast-1" --stack-name myproject-S3 \ | |
--template-url $S3_TEMPLATE_FILE \ | |
--parameters \ | |
"ParameterKey"="EnvNameParameter","ParameterValue"="bleed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $GitUserEmail ] || [ -z $GitAccessToken ] ; | |
then | |
echo "Environment Variables missing. Did you run int_env.sh?"; | |
exit; | |
fi | |
echo "You have 10 seconds to stop stack creation..." | |
#sleep 10 | |
echo "Starting stack update" | |
TEMPLATE_FILE='https://s3.amazonaws.com/mycompany/myproject/main.template' | |
aws cloudformation update-stack --stack-name BLEED-myproject \ | |
--template-url $TEMPLATE_FILE \ | |
--capabilities CAPABILITY_IAM \ | |
--parameters \ | |
"ParameterKey"="VersionParameter","ParameterValue"="v1" \ | |
"ParameterKey"="ServiceNameParameter","ParameterValue"="myproject" \ | |
"ParameterKey"="EnvNameParameter","ParameterValue"="bleed" \ | |
"ParameterKey"="SubnetsParameter","ParameterValue"="'subnet-8e443ca4'" \ | |
"ParameterKey"="VPCIdParameter","ParameterValue"="vpc-7003d217" \ | |
"ParameterKey"="SSHBastionSecurityGroup","ParameterValue"="sg-db9724a0" \ | |
"ParameterKey"="KeyNameParameter","ParameterValue"="sonu-dev" \ | |
"ParameterKey"="InstanceTypeParameter","ParameterValue"="t2.medium" \ | |
"ParameterKey"="RouterSecurityGroupParameter","ParameterValue"="sg-8d93edf6" \ | |
"ParameterKey"="GitUserEmailParameter","ParameterValue"="$GitUserEmail" \ | |
"ParameterKey"="GitAccessTokenParameter","ParameterValue"="$GitAccessToken" \ | |
"ParameterKey"="DomainNameParameter","ParameterValue"="practodev.com" | |
echo "Update s3 buckets in southeast-1 ..." | |
aws cloudformation update-stack --region "ap-southeast-1" --stack-name myproject-S3 \ | |
--template-url $S3_TEMPLATE_FILE \ | |
--parameters \ | |
"ParameterKey"="EnvNameParameter","ParameterValue"="bleed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment