Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw

58 views

Published on

AWS Lambda in Golang is a topic of lecture by Wojciech Barczyński - Lead Software Developer @ SMACC GmbH / Hypatos.ai. In his presentation, Wojtek will show you how to start, why you should use the Gopher language in as-a-function-world in comparison to NodeJS and present the implementation of the bever framework.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw

  1. 1. AWS Lambda in Golang HOW TO START Wojciech Barczyński - wb@ wbarczynski.pro@gmail.com Hypatos.ai
  2. 2. WOJCIECH BARCZYŃSKI = Hypatos.ai Lead So ware Engineer Golang Warsaw Organizer Hobby: Kubernetes/CloudNative evangelist; teacher/trainer SMACC.io
  3. 3. WHY SERVERLESS 1. Cut costs 2. Simplify 3. Generate/Prepare and cache experience in LykeHQ
  4. 4. SMACC / Hypatos 1. Kubernetes/CloudNative Agility. We own it. Observability.
  5. 5. SMACC.io / Hypatos.ia 1. Kubernetes/CloudNative 2. XaaS 3. Looking into Serverless
  6. 6. WHY GO? Readibility Performance [1][2] Cheap Concurrency [3] [1] [2] [3]go vs nodejs acloud benchmark Cost reduced
  7. 7. DISADVANTAGES Binary size Complied no way to edit Might have slower start [1] [1] Some users report slow start times
  8. 8. HOW TO START It is easy: go dep serverless framework amazon sam CLI
  9. 9. HOW TO START $ npm install -g serverless $ go get github.com/tools/godep $ brew tap aws/tap; brew install aws-sam-cli
  10. 10. DEMO - GENERATE CODE Definicja binary per handler $ serverless create -t aws-go-dep
  11. 11. DEMO - DEPLOY $ make build $ make deploy
  12. 12. DEMO - RUNNING LOCALLY 1. Prepare: template.yaml for sam 2. Execute: $ sam local start-api $ sam local start-api --env-vars env.json
  13. 13. DEMO - RUNNING LOCALLY $ curl http://127.0.0.1:3000/hello $ curl http://127.0.0.1:3000/hello/natalia $ curl http://127.0.0.1:3000/hello?name=natalia
  14. 14. DEMO - GENERATE EVENTS $ sam local generate-event $ sam local generate-event s3 put > put_s3.json $ sam local invoke "HelloWorldFunction" -e put_s3.sjon
  15. 15. DEMO - HANDLERS func () func () error func (TIn), error func () (TOut, error) func (context.Context) error func (context.Context, TIn) error func (context.Context) (TOut, error) func (context.Context, TIn) (TOut, error) AWS docs on valid handlers
  16. 16. DEMO - CONTEXT see ctx context.Context # from ctx to lambdacontext lc, _ := lambdacontext.FromContext(ctx) implementation
  17. 17. TESTING units integration locally, e.g., with in the cloud dynamodb-local localstack.cloud
  18. 18. GUIDE time is $$ Golang: Pass by value small data types Pointers for large ones Goroutines for, e.g., init
  19. 19. UNKNOWN how to asses the resources [1] how to integrate with our prometheus stack Can we take the lesson to onPrem? [1] aws-lambda-power-tuning
  20. 20. SUMMARY Golang is a fast and simple to read language Easy to use, give it a try :) Later check more complex examples
  21. 21. github.com/wojciech12/talk_serverless_in_golang Next talk: kubeless?
  22. 22. THANK YOU. QUESTIONS? We are hiring.
  23. 23. BACKUP SLIDES
  24. 24. INTERESTING Golang on Kubeless Golang Plugins and Lambda Layers golang and GraalVM AWS Fargate

×