I am unable to load parameters into the python boto3 Cloudformation client.
Below is my parameter file:
[
{"ParameterKey": "pVpcId", "ParameterValue": "vpc-XXXXXX"},
{"ParameterKey": "pContact", "ParameterValue": "XDXDXX"},
{"ParameterKey": "pCC", "ParameterValue": "XXXXX" },
{"ParameterKey": "pFormat", "ParameterValue": "True"}
]
I'm loading it into the program in the following way:
with open(parameter_file, 'r') as infile:
parameters=ast.literal_eval(infile.read())
client = boto3.client('cloudformation',aws_access_key_id=access_key,aws_secret_access_key=secret_key,aws_session_token=session_token,region_name=region)
response = client.create_stack(
StackName=stack_name,
TemplateURL=stack_url,
Parameters=parameters
)
When I establish a boto3 client with Cloudformation and call it, I get the error described below. The call works without the parameters, so it's definitely something to do with the parameter file.
Traceback (most recent call last):
File "cf_create_stack", line 85, in <module>
Parameters=parameters
File "/usr/lib/python2.7/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/lib/python2.7/site-packages/botocore/client.py", line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the CreateStack operation: Template format error: unsupported structure.