How do i send a method to a Specific stage in Cloudformation API Gatewy

0

Hi please how to send a api resource method to a specific stage and remove some method in a stage using cloud Formation

1 回答
1
已接受的回答

To help you related to add or remove some method in a specific stage in api gateway using cloudformation template, use this template

AWSTemplateFormatVersion: 2010-09-09
Description: Send a method to a specific stage and remove some methods in a stage API Gateway
Resources:
  ApiGatewayRestApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: MyRestApi
  ApiGatewayMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      HttpMethod: POST
      Path: /myresource
      RestApiId: !Ref ApiGatewayRestApi
      StageName: Prod
  ApiGatewayStage:
    Type: AWS::ApiGateway::Stage
    Properties:
      Name: Prod
      RestApiId: !Ref ApiGatewayRestApi
      MethodSettings:
        - HttpMethod: POST
          ResourcePath: /myresource
          StageName: Prod
          # Remove the methods that you don't want to use in the Prod stage
          RemoveMethod: true

Above template helps you to create an API Gateway REST API with a POST method called /myresoure. The method is configured to be used in the prod stage of the API. The ApiGatewayStage resource then removes the POST method from the Prod stage

已回答 9 个月前
  • Thank you i have multiple resouces how do i specify this resource to this stage and that resource to that stage

  • And Please after Removing can remove the block of code that did that

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则