Skip to content

sarthakj178/AWSRestServiceTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWSRestServiceTemplate

Dummy REST Service built using AWS API Gateway

Prerequisites

Setup

Set a few environment variables

export AWS_REST_SERVICE_NAME=<SOME_FOLDER_NAME> # This will be your REST Service Name as well
export AWS_REST_SERVICE_S3_BUCKET_NAME=<SOME_UNIQUE_S3_BUCKET_NAME> # This has to be unique globally

Setup the codebase

git clone https://github.com/sarthakj178/AWSRestServiceTemplate.git $AWS_REST_SERVICE_NAME
cd $AWS_REST_SERVICE_NAME
npm install

Test the service locally

sam local start-api # This will start your service locally on port 3000
curl -X GET "http://localhost:3000/ping" # On a different tab. Should return {"success":true,"message":"Hello world"}

Release to production

aws s3 mb s3://$AWS_REST_SERVICE_S3_BUCKET_NAME
sam package --template-file template.yaml   --s3-bucket $AWS_REST_SERVICE_S3_BUCKET_NAME --output-template-file packaged.yaml
sam deploy --template-file ./packaged.yaml --stack-name $AWS_REST_SERVICE_NAME --capabilities CAPABILITY_IAM

Releases

No releases published

Packages

No packages published