handler.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:aws-tailor 作者: alanwill 项目源码 文件源码
def cfn_response(response_status, response_data, reason, physical_resource_id, event, context):
    # Put together the response to be sent to the S3 pre-signed URL

    if reason:
        reason = reason
    else:
        reason = 'See the details in CloudWatch Log Stream: ' + context.log_stream_name

    responseBody = {'Status': response_status,
                    'Reason': 'See the details in CloudWatch Log Stream: ' + context.log_stream_name,
                    'PhysicalResourceId': physical_resource_id,
                    'StackId': event['StackId'],
                    'RequestId': event['RequestId'],
                    'LogicalResourceId': event['LogicalResourceId'],
                    'Data': response_data
                    }
    print('Response Body:', responseBody)
    response = requests.put(event['ResponseURL'], data=json.dumps(responseBody))
    if response.status_code != 200:
        print(response.text)
        raise Exception('Response error received.')
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号