Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Serverless Applications with Go

You're reading from   Hands-On Serverless Applications with Go Build real-world, production-ready applications with AWS Lambda

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781789134612
Length 416 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Mohamed Labouardy Mohamed Labouardy
Author Profile Icon Mohamed Labouardy
Mohamed Labouardy
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Go Serverless 2. Getting Started with AWS Lambda FREE CHAPTER 3. Developing a Serverless Function with Lambda 4. Setting up API Endpoints with API Gateway 5. Managing Data Persistence with DynamoDB 6. Deploying Your Serverless Application 7. Implementing a CI/CD Pipeline 8. Scaling Up Your Application 9. Building the Frontend with S3 10. Testing Your Serverless Application 11. Monitoring and Troubleshooting 12. Securing Your Serverless Application 13. Designing Cost-Effective Applications 14. Infrastructure as Code 15. Assessments 16. Other Books You May Enjoy

Writing a Lambda function in Go

Follow the steps in this section to create your first Lambda function in Go from scratch:

  1. To write a Lambda function, we need to install some dependencies. Hence, open a new terminal session, and install the Go Lambda package using the following command:
go get github.com/aws/aws-lambda-go/lambda
  1. Next, open your favorite Go IDE or editor; in my case, I will work with VS Code. Create a new project directory in your GOPATH and then paste the following content into a main.go file:
package main

import "github.com/aws/aws-lambda-go/lambda"

func handler() (string, error){
return "Welcome to Serverless world", nil
}

func main() {
lambda.Start(handler)
}

The previous code uses the lambda.Start() method to register an entry-point handler that contains the code that will be executed when a Lambda function is invoked. Each language supported...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime