You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何构造AWS CloudFormation中ApiGateway集成S3/SQS等服务的集成URI

API Gateway 与AWS服务集成URI构造指南

通用构造规则

AWS服务集成的URI统一遵循以下格式:
arn:aws:apigateway:<区域ID>:<服务标识>:<类型前缀>/<操作内容>

  • 区域ID:比如us-east-1、cn-north-1,CloudFormation中可直接用${AWS::Region}伪参数
  • 服务标识:对应AWS服务的小写缩写,比如s3、sqs、sns、dynamodb
  • 类型前缀:分为两类
    • path:用于路径类操作,典型为S3的对象读写
    • action:用于调用服务的OpenAPI动作,绝大多数服务操作都用该前缀

常用服务集成示例(CloudFormation配置片段)

S3 上传对象集成

Integration:
  Type: AWS
  IntegrationHttpMethod: PUT
  Uri: !Sub "arn:aws:apigateway:${AWS::Region}:s3:path/${YourBucketName}/{object-key}"
  RequestParameters:
    "integration.request.path.object-key": "method.request.path.object-key"

注:IntegrationHttpMethod要和S3的API要求一致,上传用PUT,下载用GET

SQS 推送消息集成

Integration:
  Type: AWS
  IntegrationHttpMethod: POST
  Uri: !Sub "arn:aws:apigateway:${AWS::Region}:sqs:action/SendMessage"
  RequestParameters:
    "integration.request.querystring.QueueUrl": !Sub "'${YourSQSQueueUrl}'"
    "integration.request.querystring.MessageBody": "method.request.body"

SNS 推送消息集成

Integration:
  Type: AWS
  IntegrationHttpMethod: POST
  Uri: !Sub "arn:aws:apigateway:${AWS::Region}:sns:action/Publish"
  RequestParameters:
    "integration.request.querystring.TopicArn": !Sub "'${YourSNSTopicArn}'"
    "integration.request.querystring.Message": "method.request.body"

DynamoDB 写入数据集成

Integration:
  Type: AWS
  IntegrationHttpMethod: POST
  Uri: !Sub "arn:aws:apigateway:${AWS::Region}:dynamodb:action/PutItem"
  RequestTemplates:
    application/json: |
      {
        "TableName": "${YourDynamoDBTableName}",
        "Item": $input.json('$')
      }

相关配置截图

配置截图1
配置截图2

内容的提问来源于stack exchange,提问作者Lukas Liesis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 21:15:01