Amazon API Gateway HTTP Proxy Integration Example: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 67: Line 67:
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.
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} <font color=darkgray>More clarifications here. Why do I need to specify an endpoint URL, when the VPC Link should already be wired into the network load balancer.</font>
Endpoint URL: http://playground-nlb-95d74901c7b728b1.elb.us-west-2.amazonaws.com:10001/{proxy} <font color=darkgray>More clarifications here. Why do I need to specify an endpoint URL, when the VPC Link should already be wired into the network load balancer.</font>


Use Default Timeout.
Use Default Timeout.
==Test===
{proxy+} -> ANY -> Test:
Method: GET
Path: amazons
Stage Variables:
vpcLinkId: xemf89

Revision as of 01:41, 12 February 2019

Internal

Overview

Playground

Amazon API Gateway - HTTP Proxy Integration Example

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:10001/{proxy} More clarifications here. Why do I need to specify an endpoint URL, when the VPC Link should already be wired into the network load balancer.

Use Default Timeout.

Test=

{proxy+} -> ANY -> Test:

Method: GET

Path: amazons

Stage Variables:

vpcLinkId: xemf89