gpt4 book ai didi

amazon-web-services - 如何在 REST API 的 uri 中传递 AWS AccountId(Cloudformation)

转载 作者:行者123 更新时间:2023-12-03 07:44:44 24 4
gpt4 key购买 nike

代码:

  x-amazon-apigateway-integration:
uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:428377611111:function:${stageVariables.target_lambdaName}/invocations"

如果使用如下所示的伪参数,我将面临问题。

更新的代码:

 x-amazon-apigateway-integration:
uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:${AWS::AccountId}:function:${stageVariables.target_lambdaName}/invocations"

错误:

Errors found during import: Unable to put integration on 'GET' for resource at path '/getMessage': Invalid HTTP endpoint specified for URI (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 3da76bd8-d714-11e8-8ec4-4b324c6636a4)

提前致谢。

纳雷什

最佳答案

首先,您应该从问题中删除您的 AWS 账户 ID。

如果您使用 SAM 模板 YAML 文件并在管道阶段通过 ParameterOverrides 将变量传递到模板,那么您应该在 SAM 模板 YAML 文件的文件顶部声明参数,并且您的代码应为示例 POST。

paths:
/PATH_NAME:
get:
responses: {}
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FUNCTION_NAME_HERE.Arn}/invocations
httpMethod: POST
type: aws_proxy

假设这段代码附加到:

Type: AWS::Serverless::Api

没有任何其他信息,我只是假设您想要做什么。

顺便说一句,您可以在 CloudFormation 中访问您的帐户 ID,如下所示:

${AWS::AccountId}

关于amazon-web-services - 如何在 REST API 的 uri 中传递 AWS AccountId(Cloudformation),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52958702/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com