Skip to content

Run deploy template

E. Lynette Rayle edited this page Nov 17, 2021 · 5 revisions

back to Overview

Run aws-deploy.yaml template

Reference: AWS cloudformation commands

info_24 All commands are written to be run in the deploy-templates directory. You can run them from another location, but will need to update the file paths accordingly.

Create the deploy stack

Reference: AWS cloudformation - create-stack command

info_24 The command is shown with example values for parameters. See the descriptions below the command for information on how to determine the correct values to use.
aws cloudformation create-stack --stack-name lookup-server \
    --profile lookup-cloudformation-user \
    --template-body file://./aws-deploy.yaml \
    --parameters file://./deploy-parameters.env \ 
    --role-arn arn:aws:iam::<your_account_id>:role/qa-role \
    --capabilities CAPABILITY_NAMED_IAM

where,

  • --stack-name - a unique name to hold the created resources. You will get an error if a stack with the name already exists.
  • --profile - is the name of the credentials in .aws/credentials as setup in Required Permissions. Use the same profile as used for the aws-resources.yaml template.
  • --template-body - the path to aws-deploy.yaml template
  • --parameters - the path to deploy-parameters.env created in the Set deploy parameters
  • --role-arn - your AWS Administrator will provide you this value which identifies the role that is executing the command. Use the same role as used for the aws-resources.yaml template
  • --capabilities CAPABILITY_NAMED_IAM - indicates that you are aware that this template can affect permissions in your AWS account (e.g. create new AWS Identity and Access Management (IAM) users)
warning_24 WARNING: The command will likely fail if you try to execute it across multiple lines. It is separated into multiple lines for readability. Substitute your values into the single line command below.

For your convenience, the following command is single line with default values (you will still need to substitute your value for --role-arn):

aws cloudformation create-stack --stack-name lookup-server --profile lookup-cloudformation-user --template-body file://./aws-deploy.yaml --parameters file://./deploy-parameters.env --role-arn arn:aws:iam::<your_account_id>:role/qa-role --capabilities CAPABILITY_NAMED_IAM

Check the status of the deploy stack

The steps for checking the status of the stack creation process are the same as used for the first template. See Check the status of the resource stack for more information.

Delete the deploy stack

The steps for deleting the stack are the same as used for the first template. See Delete the resource stack for more information.

warning_24 WARNING: Running this command cannot be undone. The resources will be destroyed.

Validation and Outputs

Check the status

You can confirm the status of the stack creation process and get information about the outputs of the resource allocation template in the CloudFormation Console.

  • find the stack with the name you used for --stack-name while executing the create-stack command
  • the status should be CREATE_COMPLETE when the create process completes (If the status is CREATE_IN_PROGRESS, the create process is still running.)
  • click on the stack's name
  • click on the Outputs tab

View the outputs

If the status for the stack is CREATE_COMPLETE, the deploy is complete. From Outputs tab, you can see what was created.

  • Cluster
  • LoadBalancer
  • Service
  • TaskDefinition

Previous | [Next](Setup DNS record and SSL cert)