menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Cloud News

>

Deploying ...
source image

Dev

2w

read

187

img
dot

Image Credit: Dev

Deploying Amazon API Gateway and Lambda with Terraform

  • AWS provides multiple ways to deploy infrastructure and code onto their platform, with differing levels of complexity and scalability.
  • In this example, we'll be deploying an Amazon API Gateway with links to a Lambda Function.
  • I've come to like Terraform for its more programming like features over CloudFormation, though I do still use CloudFormation in some cases.
  • The API Gateway has integrations with the Lambda via a proxy.
  • In this example, we are sending requests to the Production Stage (you could also host dev or test on the same endpoint for example), accessing the items resource (our main endpoint for dealing with our expected database), then we have multiple functions for interactions with those resources, for each request type.
  • For this example, i'll keep everything in one place to make it easier to understand, but typically you would have separate variables, outputs and maybe a backend file.
  • We then create a stage with aws_api_gateway_stage to create our production stage, passing in the rest api and the deployment we just created.
  • If this is the first time running, you should see a lot of creation messages.
  • This example can be used to expand other types of resources or Lambda functions deployed via Terraform, and in the next Blog Entry we will use this Terraform and deploy it via a Code Pipeline with a CodeBuild instance, allowing us to automate the execution of the Terraform when triggered by a commit to a GitHub repository.
  • After which you should see creation messages.

Read Full Article

like

11 Likes

For uninterrupted reading, download the app