Skip to content

Serverless API using Lambda & API Gateway, Infrastructure as Code and CI/CD using CloudFormation and AWS Code Tools

Notifications You must be signed in to change notification settings

ASLANtechnology/serverless-api-cicd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless API with CI/CD

The template: cloudformation.yml

Quickly deploy an API (API Gateway + Lambda) with /prod and /dev endpoints. Each can be running a different version of the Lambda function.

Built in CI/CD using CodePipeline & CodeBuild which pulls from your GitHub repo. Just push your changes to either the develop or master branch and a new version of the Lambda is tested and built.

Use the command line tools to quickly deploy a new version to either the dev or prod endpoints.

What AWS resources does this template use?

  • Lambda (API Function, Github webhook for CI/CD)
  • API Gateway (HTTP proxy to Lambda)
  • S3 (Lambda files)
  • CodeBuild (Continuous integration & deployment)
  • CodePipeline (Continuous integration & deployment)
  • CloudFormation (Infrastructure as Code)
  • IAM (AWS permissions & users)

Setup

npm install

Usage

./cli <command>

command = [help, stackup, show, deploy]

create

Run this command one time to build the stack.

./cli create \
--ProjectName=<project_name> \
--GitHubOwner=<user_or_organization> \
--GitHubRepo=<repo> \
--GitHubToken=<token> \
--profile=<aws_profile>

ProjectName: Please enter a name for your project. This will be the CloudFormation stack name and used as a prefix for many of the resources.

GitHubOwner: Your github username or organization name.

GitHubRepo: Your github repo name.

GitHubToken: Your github personal access token. https://github.com/settings/tokens, needs "repo" and "admin:repo_hook" checked.

profile: Your AWS credentials profile. [optional]

update

Run this command one time to update the stack.

./cli update \
--ProjectName=<project_name> \
--profile=<aws_profile>

ProjectName: Please enter a name for your project. This will be the CloudFormation stack name and used as a prefix for many of the resources.

profile: Your AWS credentials profile. [optional]

deploy

Run this command to deploy a new version to either the /prod or /dev endpoint.

./cli deploy \
--branch=<master> \
--version=<1> \
--profile=<aws_profile>

branch: Deploy to prod or dev. [master | develop]

version: Which built version to deploy?

profile: Your AWS credentials profile. [optional]

show

Run this command to see what versions have been built and which version is currently running. The deployment history is also available.

./cli show \
--branch=<master> \
--profile=<aws_profile>

branch: Which environment? prod or dev. [master | develop]

profile: Your AWS credentials profile. [optional]

About

Serverless API using Lambda & API Gateway, Infrastructure as Code and CI/CD using CloudFormation and AWS Code Tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%