in setup/lambda-custom-resource/prepare_dev_package_cr.py [0:0]
def send_response(event, context, response_status, response_data):
'''Send a resource manipulation status response to CloudFormation'''
response_body = json.dumps({
"Status": response_status,
"Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name,
"PhysicalResourceId": context.log_stream_name,
"StackId": event['StackId'],
"RequestId": event['RequestId'],
"LogicalResourceId": event['LogicalResourceId'],
"Data": response_data
})
print("Response body:")
print(response_body)
response_url = event['ResponseURL']
headers = {
'content-type' : '',
'content-length' : str(len(response_body))
}
try:
response = http.request('PUT', response_url, headers=headers, body=response_body)
print("Status code:", response.status)
except Exception as e:
print("send(..) failed executing http.request(..):", e)