Created
October 21, 2016 14:41
-
-
Save erbrito/ea97364dc4861c00a672bfa76fb16b3b to your computer and use it in GitHub Desktop.
bash that creates an AWS Stack based on a Template.
If the stack exists, it will updated it.
It recevied as parameter the name of the stack.
Requires to be configured the AWS credentials and be installed AWS CLI
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
#!/usr/bin/env bash | |
#bash that creates an AWS Stack based on a Template. | |
#If the stack exists, it will updated it. | |
#It recevied as parameter the name of the stack. | |
#Requires to be configured the AWS credentials and be installed AWS CLI | |
stackName=$1 | |
function updateStack(){ | |
echo "updating stack as it was already created" | |
local res=$(~/bin/aws cloudformation update-stack --stack-name $stackName --template-body file://build/resources/main/automation/cloudFormation/DynamoDbBundleTable) | |
echo $res | |
} | |
function createStack(){ | |
local res=$(~/bin/aws cloudformation create-stack --stack-name $stackName --template-body file://build/resources/main/automation/cloudFormation/DynamoDbBundleTable) | |
echo "res: $res" | |
if [[ ! $res =~ .*cloudformation.* ]] | |
then | |
updateStack | |
fi | |
} | |
createStack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment