HTTP Endpoint [deprecated]

The HTTP Endpoint node is deprecated. Use the Rest Api and Rest Api Endpoint nodes instead. Learn how to migrate your stack here.

HTTP Endpoint nodes create endpoints for receiving HTTP requests. When requests are received a message is output to a connected Function node.

Only one Function node may be connected to the output port. The connected Function node returns a response to be sent back for the HTTP request.

Message Formats

Stackery enables integration between AWS API Gateway methods and AWS Lambda functions using Lambda Proxy Integration. This mechanism supports rich and dynamic HTTP request/response handling.

Output

When an HTTP request is received, the HTTP Endpoint node outputs a message containing all the details of the request. Here is an overview of commonly used request properties:

Field Type Description
httpMethod string Method of the request. Example: GET
resource string Resource endpoint matching the path of the request. Example: /users/{id}
pathParameters Object Map of resource parameter values. Example: {"id": "5"}
queryStringParameters Object Map of query string parameter values. Example: {"admin": "true"}
headers Object Map of request header values. Example: {"Host": "stacks.stackery.io", "Accept": "application/json"}
body Buffer Request body.
requestContext.sourceIp string IP Address of requesting client. Example: 38.182.58.3
requestContext.requestId string Request ID as a GUID. Example: a0a5150b-a050-11e6-895a-159872556d76


See https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format for further details on the input message format.

Expected Response

The response message from the connected Function node contains the HTTP response information. Here is an overview of commonly used response properties:

Field Type Default Description
statusCode number (required) Status code of the response. Example: 202
headers Object {} Map of response header values. Example: {"Content-Type": "text/html", "Access-Control-Allow-Origin": "example.com"}
body Buffer or string null Body of response. Example: {"name": "bob"}


See https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format for further details on the response message format.

Settings

Name

A label for the node in the canvas.

Endpoint

A specification for the paths that will be handled by this request node. The value can define a single path, a path with resource parameters, and/or a wildcard (*).

Examples:

/users
/users/{id}
/users/{id}/{property}
/users/{id}/emails/{email}
/users/{id}/locations/*

When a request matches an endpoint with resource parameters, the value of the parameters will be provided in the resourceParams field of the request message. For example, a request made to /users/5/locations/US/OR/97205/9584-Oak-Leaf-Rd would have the following request message fields:

{
  ...
  "pathname": "/users/5/locations/US/OR/97205/9584-Oak-Leaf-Rd",
  "endpoint": "/users/{id}/locations/*",
  "resourceParams": {
    "id": "5",
    "*": "US/OR/97205/9584-Oak-Leaf-Rd"
  }
}

Use Custom Domain?

By default, Stackery will automatically create one domain for all the HTTP Endpoint nodes in the stack. This domain will be hosted under stackery-stacks.io.

You can also set a custom domain for each HTTP Endpoint node. The same custom domain can be shared across multiple HTTP Endpoint nodes as long as the endpoints do not overlap.

Custom Domain

The domain name that will host the Api. AWS Certificate Manager will provision an SSL certificate for this domain. In order to provision the certificate, AWS will send an email to the domain’s registration contacts and certain well-known domain administration email addresses:

  • administrator@
  • hostmaster@
  • postmaster@
  • webmaster@
  • admin@

When deploying be sure to check these email addresses to approve the certificate. If the domain is not verified within one hour of the start of the deployment the deployment will fail and be rolled back automatically.

After deployment a CNAME DNS record will need to be created for the domain. Select the current deployment in the Stackery dashboard, then select the HTTP Endpoint node in the canvas area. Find and copy the DNS Name value in the properties panel on the right. Create a CNAME record to map the custom domain to this DNS name. Check with your DNS provider for instructions on how to create the record.

Migrating to Rest Api and Rest Api Endpoint nodes

The new nodes (Rest Api and Rest Api Endpoint) are significantly faster to provision/de-provision and reduce latency for your users.

If you are not using Custom Domains on your HTTP Endpoints, and instead are using stackery-stack subdomains, then you can follow the steps to migrate. One caveat is that you will be provided a new stackery-stacks subdomain.

  1. Add a Rest Api node
  2. Add a new Rest Api Endpoint node for each existing HTTP Endpoint node
    • Place the Rest Api Endpoints into the Rest Api node
    • Copy over the Method and Path options to the new Rest Api Endpoint nodes
  3. Connect new Rest Api Endpoints to the same Function nodes that the existing HTTP Endpoint nodes are connected to
  4. Deploy your stack to provision the new resources
  5. Delete the old HTTP Endpoint nodes
  6. Deploy your stack to delete the old resources and complete the migration

If you are using Custom Domains on your HTTP Endpoint nodes, you can use the following steps to migrate your stack to using Rest Api and Rest Api Endpoint nodes:

  1. Add a Rest Api node for each custom domain used in your stack
    • Set the Rest Api node’s custom domain
  2. Add a new Rest Api Endpoint node for each existing HTTP Endpoint node
    • Place the Rest Api Endpoints into the appropriate Rest Api node
    • Copy over the Method and Path options to the new Rest Api Endpoint nodes
  3. Connect new Rest Api Endpoints to the same Function nodes that the existing HTTP Endpoint nodes are connected to
  4. Deploy your stack to provision the new resources
  5. Update your DNS records with the values from the new Rest Api nodes
  6. Delete the old HTTP Endpoint nodes
  7. Deploy your stack to delete the old resources and complete the migration

Try Stackery For Free

Gain control and visibility of your serverless operations from architecture design to application deployment and infrastructure monitoring.