CloudWiki
Resource

API Gateway

Amazon Web Services
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.
Terraform Name
terraform
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'

aws cost
Costs
API Gateway charges for the number of API calls received and the amount of data transferred out, with varying prices based on the geographical region in which the service is used. You are also charged for the amount of storage used by your APIs and the amount of data transferred in. The cost of using API Gateway can vary based on the number of API calls made, the size of data transferred, and the amount of storage used.
Direct Cost

<Region>-DataTransfer-Out-Bytes

<Region>-ApiGatewayRequest

Indirect Cost
No items found.
Best Practices for
API Gateway

Categorized by Availability, Security & Compliance and Cost

Low
Access allowed from VPN
No items found.
Low
Auto Scaling Group not in use
No items found.
Medium
Connections towards DynamoDB should be via VPC endpoints
No items found.
Medium
Container in CrashLoopBackOff state
No items found.
Low
EC2 with GPU capabilities
No items found.
Medium
EC2 with high privileged policies
No items found.
Medium
ECS cluster delete alarm
No items found.
Critical
ECS task with Admin access (*:*)
Medium
ECS task with high privileged policies
No items found.
Critical
EKS cluster delete alarm
No items found.
Medium
ElastiCache cluster delete alarm
No items found.
Medium
Ensure Container liveness probe is configured
No items found.
Medium
Ensure ECS task definition has memory limit
No items found.
Critical
Ensure EMR cluster master nodes are not publicly accessible
No items found.
More from
Amazon Web Services