How to pass AWS SAM deploy a list of capablities?
Asked Answered
U

2

9

I'm trying to pass multiple capabilities to sam deploy

sam deploy --guided --capabilities "CAPABILITY_IAM CAPABILITY_AUTO_EXPAND"

I have tried different forms of this, essentially encoding the list as an array with "[CAPABILITY_IAM, CAPABILITY_AUTO_EXPAND]", and makeing them strings "[\"CAPABILITY_IAM\", \"CAPABILITY_AUTO_EXPAND\"]"

Every time it gets to the listed capablities in the process, the only thing that is listed is CAPABILITY_IAM

The documentation says that --capabilities takes a list. What does a list of capabilities look like?

Undo answered 15/4, 2020 at 15:33 Comment(3)
Have you tried sam deploy --guided --capabilities "CAPABILITY_IAM, CAPABILITY_AUTO_EXPAND" already?Margetmargette
@Margetmargette I have now, no diceUndo
I am able to get multiple capablities to work via the samconfig.toml with the line capabilities = "CAPABILITY_IAM CAPABILITY_AUTO_EXPAND" but I can't find the correct syntax for the command line switchUndo
M
15

While it's all but obvious, what you have to do is to provide the capabilities unquoted like this:

sam deploy --guided --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND

The same applies to providing multiple values for --notification-arns and --tags as well.

I'm not sure why the AWS SAM CLI developers decided to implement it this way, but they expect a whitespace-separated list of values for these parameters.

Margetmargette answered 15/4, 2020 at 17:39 Comment(3)
That's still not picking up the auto expand capability. If I choose 'n' for Allow SAM CLI IAM role creation [Y/n]: the listed capabilities are Capabilities : ["CAPABILITY_IAM"]. If I choose 'Y' the next step always looks like Capabilities [['CAPABILITY_IAM']]:, and it ends up with the same capabilities listed.Undo
Did you try running it without --guided? When I did that the summary showed me both capabilities.Margetmargette
If I'm not going to use --guided then I can just set it in the samconfig.toml. This seems like a bug with the guided functionalityUndo
K
-1

Either of following should work :

sam deploy --guided --capabilities=['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM']

sam deploy --guided --capabilities=["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]

Kriskrischer answered 18/8, 2022 at 11:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.