CloudWiki

Amazon Web Service (AWS)

API Gateway

Network
Amazon API Gateway is a fully managed service that enables developers to create, publish, maintain, monitor, and secure APIs at any scale. It basically connects non-AWS applications to AWS back-end resources, such as servers and code. The API gateway accepts and processes concurrent API calls, which happens when APIs submit requests to a server. It manages traffic, authorizes end users and monitors performance.
aws_api_gateway_resource
API Gateway
attributes:
  • rest_api_id - (Required) ID of the associated REST API
  • parent_id - (Required) ID of the parent API resource
  • path_part - (Required) Last path segment of this API resource.

Associating resources with a
API Gateway
Resources do not "belong" to a
API Gateway
Rather, one or more Security Groups are associated to a resource.
Create
API Gateway
via Terraform:
The following HCL creates an API Gateway resource
Syntax:

resource "aws_api_gateway_rest_api" "MyDemoAPI" {
 name        = "MyDemoAPI"
 description = "This is my API for demonstration purposes"
}

resource "aws_api_gateway_resource" "MyDemoResource" {
 rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
 parent_id   = aws_api_gateway_rest_api.MyDemoAPI.root_resource_id
 path_part   = "mydemoresource"
}

Create
API Gateway
via CLI:
Parametres:

create-resource
--rest-api-id <value>
--parent-id <value>
--path-part <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]

Example:

aws apigateway create-resource --rest-api-id 1234123412 --parent-id a1b2c3 --path-part 'new-resource'

Best Practices for
API Gateway

Categorized by Availability, Security & Compliance and Cost

Info
Ensure API Gateway has Content Encoding feature enabled
Explore all the rules our platform covers
All Resources