We will now create Launch a CloudFormation Stack through the AWS CLI. After running through the Lab you will be able to better understand:
- How to launch a Stack from a YAML formatted file
- Deploy the Stack through the AWS CLI
For this lab, you will need to be in the ~/environment/aws-vls-cpt-ci_cd_workshop/labs/05-infra-as-code
directory in Cloud9:
$ cd ~/environment/aws-vls-cpt-ci_cd_workshop/labs/05-infra-as-code
Create the stack with resources Defined in the cfn-template.yml in the current directory
-
Be sure to Update the [YOUR STACK NAME] in the command bellow to a name of your choosing
aws cloudformation create-stack --stack-name [YOUR STACK NAME] --template-body file://cfn-template.yml
-
You are also able to pass in parameters through the CLI, in this case you can name the DynamoDB table that is created through passing TableName
aws cloudformation create-stack --stack-name [YOUR STACK NAME] --template-body file://cfn-template.yml --parameters ParameterKey=TableName,ParameterValue=artistTable
Output
{
"StackId": "arn:aws:cloudformation:eu-west-1:XXXXXXXXXXXXX:stack/[YOUR STACK NAME]/8832c420-5bc7-11eb-8215-06834f7e094f"
}
Keep an eye out for "StackStatus"
aws cloudformation describe-stacks --stack-name [YOUR STACK NAME]
You can also view the status through the console Navigate to the Cloudformation Console Select your stack to view the Events.