Reputation: 81
I am trying to use boto3 to update an existing CloudFormation template, but my code fails on the 'Parameters' property! Here is what I have tried:
Read params from a config file
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.optionxform=str
parser.read( '/parms/SecGrpsParams.cfg')
parms = dict(parser.items('params'))
print parms" produces
{'Application': 'Click2Buy', 'AdminCidr': '10.0.0.0/8', 'AppMoniker': 'c2b', 'vId': 'vpc-3bec005f'}
Call update_stack
client = boto3.client('cloudformation')
response = client.update_stack(
StackName = args.stackname,
TemplateURL = template,
Parameters = args.params,
Capabilities = ['CAPABILITY_IAM']
)
And the code produces this error:
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter Parameters,
value: {'Application': 'Click2Buy', 'AdminCidr': '10.0.0.0/8', 'AppMoniker': 'c2b', 'vId': 'vpc-3bec005f'},
type: type: , valid types: ,
I have tried to args.params.items()
, [args.params]
, and [args.params.items()]
but can't figure out what is needed.
Upvotes: 3
Views: 8017
Reputation: 81
I've discovered the problem with my pervious attempts. The "update_stack" call wants a list object passed to the 'Parameters' field in the form of Parameters = [{'ParameterKey':"parm_name", "ParameterValue":'parm_value'}].
And, the number of passed parameters must be an exact match of the Parameters definition in the CloudFormation template in number and syntax.
Upvotes: 5