Amazon web services 在内联python中使用cfnresponse创建自定义后台云形成资源时出错

Amazon web services 在内联python中使用cfnresponse创建自定义后台云形成资源时出错,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,正在尝试将内联python lambda函数创建为自定义支持的cloudformation资源。。使用cfnresponse获取资源创建的信息..但我的堆栈正在回滚,并出现错误 错误:CustomResource属性错误:供应商响应在S3 bucket cloudformation-Custom-resource-storage-uswest2中的对象arn:aws:cloudformation:us-west-2:stack/Custom lambda/8eaeead0-68b8-11e9-8

正在尝试将内联python lambda函数创建为自定义支持的cloudformation资源。。使用cfnresponse获取资源创建的信息..但我的堆栈正在回滚,并出现错误

错误:CustomResource属性错误:供应商响应在S3 bucket cloudformation-Custom-resource-storage-uswest2中的对象arn:aws:cloudformation:us-west-2:stack/Custom lambda/8eaeead0-68b8-11e9-8e31-0247c451c136 | CustomResource | 3a7885fc-0959-4284-b4f6-8153fe6420df中不包含消息键。用户请求的回滚

{
“AWSTemplateFormatVersion”:“2010-09-09”,
“Description”:“AWS CloudFormation使用Lambda设置自定义CloudFormation资源,然后在同一模板中调用它。”,
“资源”:{
“自定义功能”:{
“类型”:“AWS::Lambda::Function”,
“财产”:{
“代码”:{
“ZipFile”:{
“Fn::Join”:[
“\n”,
[
“导入urllib2”,
“导入操作系统”,
“进口boto3”,
“导入json”,
“导入CFN响应”,
def lambda_处理程序(事件、上下文):“,
"",
“印刷“事件”,
“打印json.dumps(事件)”,
“印刷品”,
"",
“pid=‘optionalPhysicalID’”,
“响应={}”,
"",
“试试看:”,
"",
“响应['Output']='-'+事件['ResourceProperties']['Input'].upper()+'-'”,
"",
“如果事件['RequestType']='Create':”,
“打印“创建堆栈”,
"",
“如果事件['RequestType']='Update':”,
“打印‘更新堆栈’”,
"",
“如果事件['RequestType']='Delete':”,
“打印'删除堆栈'”,
"",
“例外情况除外,如e:”,
“打印str(e)”,
“cfnresponse.send(事件,上下文,cfnresponse.FAILED,{'error':str(e)},pid)”,
“返回”,
"",
“cfnresponse.send(事件、上下文、cfnresponse.SUCCESS、响应、pid)”,
"",
“client=boto3.client('s3')”,
“response=urllib2.urlopen('responsehttps://s3-us-west-2.amazonaws.com/')",
“html=response.read()”,
“文件名='test.sh'”,
“路径='/tmp/'+文件名”,
“文件=打开(路径'w')”,
“文件写入(html)”,
“文件\uux.close()”,
“本地文件名='tmp/'+文件名”,
“account_number=boto3.client('sts').get_caller_identity().get('account')”,
“打印(帐号)”,
“client.create_bucket(bucket='abc-'+账号+'-emr文件)”,
“CreateBucketConfiguration={'LocationConstraint':'us-west-2'})”,
“client.put_对象(Bucket='abc-'+帐户号+'-emr文件',Key=filename)”
]
]
}
},
“作用”:{
“Fn::Join”:[
"",
[
“arn:aws:iam:”,
{
“Ref”:“AWS::AccountId”
},
“:角色/AWS\uu AD\u DNS\u EMR\u Clnup\u Lambda\u Exctn\u角色”
]
]
},
“处理程序”:“index.lambda_处理程序”,
“记忆化”:“128”,
“运行时”:“python2.7”,
“超时”:180
},
“元数据”:{
“AWS::CloudFormation::Designer”:{
“id”:“e683a5e0-d8e2-4747-84ed-3273acd09d66”
}
}
},
“客户资源”:{
“类型”:“自定义::自定义资源”,
“财产”:{
“ServiceToken”:{
“Fn::GetAtt”:[
“自定义功能”,
“阿恩”
]
},
“输入”:“要传递到自定义Lambda函数的参数”
},
“元数据”:{
“AWS::CloudFormation::Designer”:{
“id”:“2a474cb7-859c-4647-958e-c72674dd1a6b”
}
}
}
},
“产出”:{
“信息”:{
“描述”:“来自自定义资源的消息。”,
“价值”:{
“Fn::GetAtt”:[
“客户资源”,
“消息”
]
}
},
“客户经理”:{
“说明”:“海关的arn”