skip to Main Content

I’m trying to deploy nested stack using command

aws cloudformation deploy --stack-name "${STACK_NAME}" --template-file "${S3_ROOT_TEMPLATE}" --parameter-overrides ${PARAMS[@]} --region ${REGION}

But despite the S3_ROOT_TEMPLATE having proper url, I get the error

Invalid template path
https://<s3-bucket-name>.s3.us-east-2.amazonaws.com/sm-domain-templates/main_stack.yaml

Any idea what’s wrong with the above?

2

Answers


  1. Chosen as BEST ANSWER

    Even though in the console you have to use S3 path, in the awscli command, it expects the local file path of the root stack file


  2. The following command deploys a template named S3_ROOT_TEMPLATE to a stack named STACK_NAME:

    STACK_NAME="cfn-demo"
    S3_ROOT_TEMPLATE="cfn-demo.yaml"
    REGION="us-east-1"
    bucket_name="cfn-demo-bucket"
    aws cloudformation deploy --stack-name $STACK_NAME --template-file $S3_ROOT_TEMPLATE --parameter-overrides $PARAMS[@] --region $REGION
    

    If your templates are sized greater than 51,200 bytes, then the name of the S3 bucket where this command uploads your CloudFormation template.

    aws cloudformation deploy --stack-name $STACK_NAME --template-file $S3_ROOT_TEMPLATE --parameter-overrides $PARAMS[@] --region $REGION  --s3-bucket $bucket_name
    

    For updating the stack, you could upload the template file to the S3 bucket by using copy and then, update the stack by using the S3 object URL as the template source.

    aws s3 cp $S3_ROOT_TEMPLATE s3://$bucket_name
    aws cloudformation update-stack --stack-name $STACK_NAME --template-url https://$bucket_name.s3.$REGION.amazonaws.com/$S3_ROOT_TEMPLATE
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search