AWS API Gateway Method Response

This page shows how to write Terraform and CloudFormation for API Gateway Method Response and write them securely.

aws_api_gateway_method_response (Terraform)

The Method Response in API Gateway can be configured in Terraform with the resource name aws_api_gateway_method_response. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

api_gateway_method_response.tf#L1
resource "aws_api_gateway_method_response" "tfer--0abe4bmm65-002F-59easd-002F-OPTIONS-002F-200" {
  http_method = "OPTIONS"
  resource_id = "59easd"

  response_models = {
    "application/json" = "Empty"

Parameters

Explanation in Terraform Registry

Provides an HTTP Method Response for an API Gateway Resource.

AWS::ApiGateway::Method MethodResponse (CloudFormation)

The Method MethodResponse in ApiGateway can be configured in CloudFormation with the resource name AWS::ApiGateway::Method MethodResponse. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

ResponseModels The resources used for the response's content type. Specify response models as key-value pairs (string-to-string maps), with a content type as the key and a Model resource name as the value.
Required: No
Type: Map of String
Update requires: No interruption

ResponseParameters Response parameters that API Gateway sends to the client that called a method. Specify response parameters as key-value pairs (string-to-Boolean maps), with a destination as the key and a Boolean as the value. Specify the destination using the following pattern: method.response.header.name, where name is a valid, unique header name. The Boolean specifies whether a parameter is required.
Required: No
Type: Map of Boolean
Update requires: No interruption

StatusCode The method response's status code, which you map to an IntegrationResponse.
Required: Yes
Type: String
Update requires: No interruption

Explanation in CloudFormation Registry

MethodResponse is a property of the AWS::ApiGateway::Method resource that defines the responses that can be sent to the client that calls a method.

Frequently asked questions

What is AWS API Gateway Method Response?

AWS API Gateway Method Response is a resource for API Gateway of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS API Gateway Method Response?

For Terraform, the denniswed/headsincloud-FO-copy source code example is useful. See the Terraform Example section for further details.