문제

I'm implementing CloudFormation in boto and ran into a weird exception.

[sebastian ~/test_project (develop)]$ ./manage.py --template cf-templates/test_project.json --stack labs --validate
Validating template cf-templates/test_project.json..
Template cf-templates/test_project.json is valid!
[sebastian ~/test_project (develop)]$ ./manage.py --template cf-templates/test_project.json --stack labs --start
Creating stack labs with template cf-templates/test_project.json..
Traceback (most recent call last):
  File "./manage.py", line 311, in <module>
    main()
  File "./manage.py", line 113, in main
    start_stack(cf_con, parser, args, config)
  File "./manage.py", line 261, in start_stack
    template_body=get_json_from_template(args.template))
  File "/usr/local/lib/python2.7/site-packages/boto/cloudformation/connection.py", line 208, in create_stack
    raise self.ResponseError(response.status, response.reason, body)
boto.exception.BotoServerError: BotoServerError: 400 Bad Request
None

As you can see I am executing two commands. The first one calls validate_template and it is OK. The second one calls start_stack like this:

cf_con = cloudformation.connect_to_region(
    args.region,
    aws_access_key_id=config.get(
        args.config_section, 'aws_access_key_id'),
    aws_secret_access_key=config.get(
        args.config_section, 'aws_secret_access_key'))

cf_con.create_stack(
    args.stack,
    template_body=get_json_from_template(args.template))

I don't really know what the problem might be as all I get back from boto is None in the error message. But maybe that is an indication of something?

Any pointers in the right direction is highly appreciated!

PS. It works fine to start the stack from AWS Console with the same template. DS.

도움이 되었습니까?

해결책

Thanks for the help garnaat, when debugging I saw the following:

2012-10-14 19:18:58,377 foo [ERROR]:400 Bad Request
2012-10-14 19:18:58,377 foo [ERROR]:{"Error":{"Code":"InsufficientCapabilitiesException","Message":"Requires capabilities : [CAPABILITY_IAM]","Type":"Sender"},"RequestId":"389d102d-1623-11e2-b536-cb51e58a0a52"}

So I have added the capability to the code:

cf_con.create_stack(
    args.stack,
    template_body=get_json_from_template(args.template),
    capabilities=['CAPABILITY_IAM'])
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top