Amazon API Gateway HTTP Proxy Integration Example: Difference between revisions
Line 36: | Line 36: | ||
==Create Resources== | ==Create Resources== | ||
Additional resources can be created by going to API -> <''API name''> -> Resources -> "/" -> Actions -> Create Resource. | |||
For the simplest possible proxy integration, the only resource created under root is a [[Amazon_API_Gateway_Concepts#Proxy_Resource|proxy resource]], meaning that it forwards everything that comes to the integration endpoint. | For the simplest possible proxy integration, the only resource created under root is a [[Amazon_API_Gateway_Concepts#Proxy_Resource|proxy resource]], meaning that it forwards everything that comes to the integration endpoint. | ||
Resource | Select "/" -> Actions -> Create Resource. | ||
Configure as "proxy resource". This is just a convenience control, will fill out the fields with appropriate values, | |||
Resource name: proxy | |||
Resource path: {proxy+} | |||
Enable API Gateway [[Amazon_API_Gateway_Concepts#CORS|CORS]]. | Enable API Gateway [[Amazon_API_Gateway_Concepts#CORS|CORS]]. | ||
Create Resource. | |||
The resource thus created comes with an "ANY" method. | |||
Select it and configure it as follows: | |||
Integration type: VPC Link. | |||
Use Proxy Integration: Check. <font color=darkgray>Why do we need to check that, while we're selecting "VPC Link" above anyway?</font> | |||
VPC Link: Use Stage Variables | |||
< | Stage Variable: <tt>${stageVariables.vpcLinkId}</tt> | ||
We can select the VPC Link directly in the drop-down box, but using a stage variable gives us more flexibility, as we can simultaneously deploy in two different stages and use two different VPC Links. | |||
Endpoint URL: http:// | Endpoint URL: http://playground-nlb-95d74901c7b728b1.elb.us-west-2.amazonaws.com/{proxy} <font color=darkgray>More clarifications here.</font> | ||
Content Handling: Passthrough | Content Handling: Passthrough |
Revision as of 01:32, 12 February 2019
Internal
Overview
Playground
Procedure
Create the API
API Gateway Console -> APIs -> Create API
Protocol
REST
Create new API
New API
Settings
API Name: themyscira
Description:
Endpoint Type: Regional.
Create API: the API, and its root resource will be created.
Create Resources
Additional resources can be created by going to API -> <API name> -> Resources -> "/" -> Actions -> Create Resource.
For the simplest possible proxy integration, the only resource created under root is a proxy resource, meaning that it forwards everything that comes to the integration endpoint.
Select "/" -> Actions -> Create Resource.
Configure as "proxy resource". This is just a convenience control, will fill out the fields with appropriate values,
Resource name: proxy
Resource path: {proxy+}
Enable API Gateway CORS.
Create Resource.
The resource thus created comes with an "ANY" method.
Select it and configure it as follows:
Integration type: VPC Link.
Use Proxy Integration: Check. Why do we need to check that, while we're selecting "VPC Link" above anyway?
VPC Link: Use Stage Variables
Stage Variable: ${stageVariables.vpcLinkId}
We can select the VPC Link directly in the drop-down box, but using a stage variable gives us more flexibility, as we can simultaneously deploy in two different stages and use two different VPC Links.
Endpoint URL: http://playground-nlb-95d74901c7b728b1.elb.us-west-2.amazonaws.com/{proxy} More clarifications here.
Content Handling: Passthrough
Use Default Timeout.