43

I am trying to validate a Cloudformation template. The command I am issuing is:

▶ aws cloudformation validate-template --template-body file://template.json

The response I am getting, however, is:

"CapabilitiesReason": "The following resource(s) require capabilities: 
  [AWS::IAM::Role]", 

I can't find any way to set the capability unfortunately.

How do you set the capability?

2
  • 2
    I have the same problem. --capabilities=CAPABILITY_IAM with create-stack cli commands makes stacks but validate-stack seems to require this capability also but there is no cli option for adding it
    – Vorsprung
    Jul 20, 2016 at 9:29
  • 5
    It's not an error. It's a notification to inform you that when you execute create-stack or update-stack that you have to specify the CAPABILITY_IAM capability.
    – jzonthemtn
    Jul 21, 2016 at 13:44

1 Answer 1

51

The Capabilities and CapabilitiesReason outputs from validate-template are not errors. They are normal outputs listing resources requiring capabilities that will need to be specified (via --capabilities) when running create-stack or update-stack in the future.

You can confirm that a validation succeeded without errors by checking that the return code is 0 indicating the command completed successfully.

The documentation for the validate-template outputs is as follows:

Capabilities -> (list)

The capabilities found within the template. If your template contains IAM resources, you must specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value for this parameter when you use the create-stack or update-stack actions with your template; otherwise, those actions return an InsufficientCapabilities error. For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.

CapabilitiesReason -> (string)

The list of resources that generated the values in the Capabilities response element.

2
  • 42
    Poor design. The output totally suggests that something required is amiss.
    – Michael M
    Jan 20, 2017 at 6:31
  • 11
    @MichaelMügge after using aws for a while I must say that alot of the AWS UI and cli is poorly designed, one just has to get used to its quirks :)
    – Millenjo
    Jun 12, 2017 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.