Golang: Serverless deployment using AWS Cloudformation

Golang: Serverless deployment using AWS Cloudformation

·

2 min read

Do you know how to speed up your serverless application deployment using AWS Cloudformation?

This post will teach you how to deploy your app to AWS lambda and API Gateway using AWS Cloudformation.

Serverless architectures are easy to use. But did you ever think you can deploy them quickly too? AWS Cloudformation takes the lead for it.

Prerequisites

  1. IAM user — to perform AWS CLI operations on our behalf.
  2. S3 bucket — to upload a zip of our code.

Table of contents

  • IAM user permissions
  • Introduction to AWS Lambda and API Gateway
  • Introduction to Cloudformation
  • Configure AWS CLI with IAM user
  • Create Cloudformation stack using AWS CLI
  • Get familiar with the Clouformation template
  • Create AWS Lambda Execution Role using Cloudformation
  • Create AWS Lambda function using Cloudformation
  • Create API Gateway Rest API using Cloudformation
  • Create API Gateway method, resource, and proxy using Cloudformation
  • Create a Lambda permission to allow API Gateway to invoke the Lambda function using Cloudformation
  • Configure a custom domain to access API Gateways using Cloudformation

Cloudformation works a way better to automate any AWS service deployments like EC2, IAM, and many more.

If you want to refer to the full code, it’s available at serverless deployment using Cloudformation with GitLab CI integration.

To learn more, read the post on canopas blog.

Did you find this article valuable?

Support Canopas by becoming a sponsor. Any amount is appreciated!