This document provides an overview of AWS and serverless computing using AWS Lambda. It discusses the history of AWS and services like S3, EC2, and Azure. It then describes AWS Lambda and how it allows code to be executed in response to events without managing infrastructure. The document demonstrates building an S3 bucket and Lambda function triggered by S3 events. It also discusses testing Lambda functions, API Gateway for building APIs, and hosting ASP.Net applications on Lambda.
3. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
Brief History
Started with S3 in March 2006
Shortly there after added SQS (which really wasn’t a queue)
August 2006 starts rollout of EC2 but isn’t ready for public until August
2007
April 2008 Google launches App Engine
February 2010 Microsoft launches Azure
Along new services offerings are added. As of today there 19 different
top-level categories of services and more than 90 different services to use
4. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
There is no cloud or
computer
5. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
AWS Lambda
Lambda is a compute service (Serverless) that executes code when needed with
automatic scaling
Triggered by events
File events in S3 (Add, Delete)
Changes in DynamoDB
Data Stream processing
API Gateway Requests
Functions can be written in Node, Java, C#, Go, and Python
No access to underlying system
Amazon manages OS and language runtime
Use EC2 or Elastic Beanstalk if you need more control.
7. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
Lambda Testing
Easy to unit and integration test if using Visual Studio
See logs and events, throttle memory, add timeouts, all from VS
Or, since 2017, test using the AWS Serverless Application Model (AWS
SAM) CLI by deploying the lambda to a local environment. This was
handy using VS Code but I found the tools in full VS to be the better
option
https://github.com/awslabs/serverless-application-model
9. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
API Gateway - Proxies
Configured on a per method basis
Can redirect to hit a lambda function
Can hit another API
Can forward credentials from initial call
Or, authenticate in another way (e.g., another lambda, AWS Cognito
User Pools)
10. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
API Gateway – Data
Mapping
Request body and headers can be passed along or transformed
Incoming and outgoing
Models and mapping templates can be set up to transform data
Other lambdas may be hit before passing along or returning data to
transform
Custom responses can be created and returned per HTTP status code
e.g. “400 - Bad Request - That request was bad and you should feel
bad”
11. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
API Gateway -
Management
Fast and simple deployment to configured environments (PROD, QA,
DEMO, DEV, etc)
Environments can be reused or created ad-hoc at the time deployment
Easy to manage documentation for each API method
Easy to export documentation for the full API
Swagger
Postman
Or conversely, an API Gateway can be created via import from a
Swagger export
The difficult part – finding anything in the API Gateway UI.
13. EMPATHIZE THEN OWN IT | BUILD SMART | DELIVER WITH PRIDE
Bonus Time
Logging to CloudWatch Logs
Back in January, Amazon made a set of packages and templates
available to let you run ASP.Net Core 2.0 in Lambda
This means you don’t have to even set up Elastic Beanstalk to be able
to host your ASP.Net Core website.
There is a template to do all of the CloudFormation (provisioning) as
part of the project
AWS has command line tools (Because Chad)