1

I'm attempting to create a script to automate the deployment/updating of my SAM stack. I'm using batch to do this. Right now I have:

call aws cloudformation deploy --template-file "serverless.yml"  ^
--stack-name %1   ^ 
--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_IAM^
--parameter-overrides   ^
  StageName=%1^
{some other parameters}
--role-arn {my role arn}

where %1 is the batch argument with the stack/stage name.

When i attempt to run this, I get the error in the cloudformation console that I need CAPABILITY_AUTO_EXPAND to update some of my stacks. Looking at the documentation, it looks like aws cloudformation deploy does not support this capability? And aws cloudformation update-stack does not accept a filename for a template.

Any suggestions on how to do this?

Posiden104
  • 31
  • 6

3 Answers3

1

probably you should use clean formatting

 aws cloudformation deploy \
    --region "${region}" \
    --template-file output.yaml \
    --stack-name "${stackName}" \
    --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND \
    --parameter-overrides ;
DHEERAJ
  • 571
  • 6
  • 9
0

See answer provided by similar question and the answer relevant to the cli commands.

Sorry would have used comment instead of answer but don't yet have privileges.

pkarfs
  • 993
  • 7
  • 19
  • This doesnt work. I used sam deploy instead of aws cloudformation deploy, and put the capabilities at the end. and the permissions still did not work. – Posiden104 Apr 17 '20 at 19:01
0

After switching to sam deploy I figured out that it was an issue with the spaces before and after my line breaks.

Specifically I think I had too many spaces in

--stack-name %1{space}{space}{space}^{space}

then no space after the capabilities line. Cleaned up the spacing throughout the command and it works now

I believe that the biggest issue was the space after the ^

Posiden104
  • 31
  • 6