Automate AWS API Gateway using CloudFormation

I have written a couple of posts on my experiences building applications with API Gateway and AWS Lambda. I have also complained a bit about the lack of support for automation of the API Gateway setup. Today I’m happy to share my open source setup that allows you to automate AWS API Gateway using CloudFormation.

In essence, this project aims to close the current gap in CloudFormation when it comes to API Gateway. Using this tool you can provision API Gateway resources writing standard CloudFormation templates. This allows you to integrate API Gateway with other AWS resources directly. For instance, you’ll be able to assign a Lambda ARN to an API Gateway Method directly in your template by accessing the outputs from the Lambda function resource.

In addition to the tight integration with your other resources, I have tried to simplify a few things such as managing CORS configurations. All in all, I hope that this project will help others who are struggling with setting up AWS API Gateway in an automated fashion.

To get started, you simply clone the repository and follow the setup instructions. Once the setup is complete, you can create API Gateway resources using regular CloudFormation templates.

In short, you will install an AWS Lambda function, along with a few other resources, in your Amazon account. This Lambda function integrates directly with the API Gateway SDK and orchestrates the setup of you API Gateway resources via Custom Resources.

I will provide a longer follow up post on this in a couple of weeks. For now, I’d love feedback and contributions.

Visit AWS API Gateway for CloudFormation on Github

This blog post is part of a series of posts on server-less deploys on AWS using API Gateway and AWS Lambda.

 

Leave a Reply