Skip to content

Serverless Golang REST API with AWS Lambda. Deploying a Golang API to AWS Lambda and handling requests through AWS API Gateway

Notifications You must be signed in to change notification settings

vyas-git/serverless-aws-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Serverless api aws lambda

Serverless Golang REST API with AWS Lambda. Deploying a Golang API to AWS Lambda and handling requests through AWS API Gateway

AWS Setup & Configure

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }

  • Create Role with trust policy

aws iam create-role --role-name lambda-function-executor \ --assume-role-policy-document file://./tmp/trust-policy.json

  • Attach the policy AWSLambdaBasicExecutionRole using the aws iam attach-role-policy command as below

` aws iam attach-role-policy --role-name lambda-function-executor
--policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole

`

  • Now, let us deploy the actual Lambda function to AWS using the command aws lambda create-function

functionName=gettingstarted #you can give your preferred name aws lambda create-function --function-name $functionName --runtime go1.x \ --role $rolearn \ --handler main --zip-file fileb://./output/function.zip

  • check list of functions aws lambda list-functions

About

Serverless Golang REST API with AWS Lambda. Deploying a Golang API to AWS Lambda and handling requests through AWS API Gateway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages