Professional Documents
Culture Documents
SVS308 R - AWS Serverless Developer Experience A Day in The Life of A Developer
SVS308 R - AWS Serverless Developer Experience A Day in The Life of A Developer
SVS308 R - AWS Serverless Developer Experience A Day in The Life of A Developer
SVS308-R
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn today
In the first 20 minutes
• A crash course on the AWS Serverless Application
Model (AWS SAM)
• An overview of the Unicorn Properties architecture
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Before we get started
Make sure you have disconnected your mobile device from the
re:Invent Wi-Fi network
If you need assistance, please raise your hand and one of our
friendly workshop developers will come and assist you
Have fun
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why we created this workshop
Provide you with hands-on experience using the AWS
SAM and AWS SAM CLI
Introduce you tools, utilities, and development
practices that can make you a productive serverless
developer
Showcase how you can apply serverless application
integration patterns, event-driven architectures, and
orchestration using a real world architecture
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS SAM crash course
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS SAM comes in two parts
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS SAM serverless resources
8
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
serverless
AWS::Serverless::Application
resource types
AWS::Serverless::StateMachine
AWS::Serverless::Connector New
SAM Version 2016-10-31
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda function event sources
17
• Amazon S3 • Amazon EventBridge
rule
• Amazon SNS
• Amazon CloudWatch
• Amazon Kinesis Logs
• Amazon DynamoDB • AWS IoT rule
76
Policy template Description
s12d.com/sam-policies S3FullAccessPolicy
Gives full access permission to act on the objects in an Amazon
S3 bucket
Gives read-only permission to read objects in an Amazon S3
S3ReadPolicy bucket
Gives write permission to write objects into an Amazon S3
S3WritePolicy bucket
• CLI tool for local development, debugging, testing, deploying, and monitoring
of serverless applications
• Supports API Gateway proxy-style and Lambda service API testing
• Response object and function logs available on your local machine
• Uses open-source docker-lambda images to mimic Lambda’s execution
environment such as timeout, memory limits, runtimes
• Tails production logs from CloudWatch logs
• Helps you build in native dependencies
https://s12d.com/sam
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
SAM CLI commands
• init Init an AWS SAM application
• build Build your Lambda Function code
• local Run your serverless function locally
• deploy Deploy an AWS SAM application
• delete Delete an application and the artifacts created by ‘sam deploy’
• logs Fetch logs for a function
• traces Fetch AWS X-Ray traces
• sync Sync a project to AWS
• pipeline Manage the continuous delivery of the application
• package Package an AWS SAM application
• validate Validate an AWS SAM template (tip: use the --debug flag to see transformed template)
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The workshop
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introducing Unicorn Properties
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The architecture
WHAT YOU WILL BUILD TODAY
Unicorn Contracts
Unicorn.Cont ract s
1
Cont ract s
t able
Agent Cont ract s API Cont ract s Cont ract st at us changed Cont ract st at us Propert y
funct ion event handler t able approvals sync
Paramet er St ore
Propert y images
S3 bucket Unicorn.Propert ies
Cust omer
Search
Propert ies
Web API
funct ion
3 Unicorn Properties
Agent
Approval
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The architecture
BUILDING THE CONTRACTS SERVICE
Cont ract s
• Contracts and properties are
t able Amazon Event Bridge correlated by the Property ID
Cont ract st at us
changed event Unicorn Propert ies event bus • The Property ID is the
properties address formatted
as a unique string:
Agent Cont ract s API Cont ract s
funct ion
Cont ract s regist ry
“usa/anytown/main-street/111”
• Publish the
ContractStatusChanged
event and create a schema
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The architecture
BUILDING THE PROPERTIES WEB
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The architecture
BUILDING THE PROPERTIES SERVICE
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The architecture
THE PROPERTIES SERVICE WORKFLOW
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Choose your own runtime
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Tools you’ll be using
s12d.com/serverless-rules
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Serverless CI/CD
AWS SAM PIPELINES
+ + +
AWS Cloud9 AWS CodeCommit AWS CodePipeline AWS CodeBuild
3 4 uni-prop-dev-contracts
2
Pipeline
Parameter Store Filter CodeCommit events
uni-prop-dev-properties
5 3 Query last commit ID
uni-prop-dev-properties-web
5 Trigger appropriate pipeline
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s get started
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Getting started with this workshop
• As a participant, you will have access to an AWS account with any optional pre-
provisioned infrastructure and IAM policies needed to complete this workshop
• The AWS account will only be available for the duration of this workshop; you
will lose access to the account thereafter
• Be sure to review the terms and conditions of the event; do not upload any
personal or confidential information in the account
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Step 1: Sign in via your preferred method
https://catalog.workshops.aws/join
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Step 2: Enter event access code
Enter 12-digit event access code; if you were given a one-click join link, you can
skip this step
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Step 3: Review terms and join event
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Step 4: Access AWS account
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Step 5: Get started with the workshop
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
Stephen Liedig Tomas Mihalyi
@sliedigaws tomas-mihalyi-0762a392
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.