SlideShare a Scribd company logo
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Pro Tips for Builders on AWS
Pahud Hsieh
Specialist SA, Serverless
Amazon Web Services
A little bit about me
• Serverless Specialist SA, GCR
• Focus on Serverless, Container and DevOps
• Father of a 5-year-old daughter
• Was Living in Shanghai 2006-2012
• Fan of road trip. Been to Siberia, Balkans,
India, Cuba and Svalbard
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
AWS CLI
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Why we love the CLI
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
JMESPath
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
$ aws ec2 describe-regions
$ aws ec2 describe-regions --query 'Regions[*].RegionName'
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
$ aws ec2 describe-regions --query 'Regions[?starts_with(RegionName,
`us`)].RegionName'
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
$ aws ec2 describe-regions --query 'Regions[?starts_with(RegionName,
`us`)].RegionName’ --output table
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
# assign $regions as bash array
$
# number of regions
$ echo ${#regions[@]}
# for loop processing
$ for r in ${regions[@]}
do
custom_process_logic $r
done
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Who am I?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
$ aws sts get-caller-identity
{
"Account": "901234567890",
"UserId": "AIDAJVHX3XBRH4AFDCYHS",
"Arn": "arn:aws:iam::901234567890:user/pahud"
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Assume-Role
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
$ cat ~/.aws/config
[default]
region = us-west-2
[profile devops]
source_profile = default
role_arn = arn:aws:iam::643758553812:role/AdminRole4Switch
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
$ aws --profile devops sts get-caller-identity
{
"Account": "643758553812",
"UserId": "AROAI4IWAM5EDVG5YGZ1W:botocore-session-
1561296250",
"Arn": "arn:aws:sts::643758553812:assumed-
role/AdminRole4Switch/botocore-session-1561296250"
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
AWS CLI in Docker
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
FROM alpine:latest
RUN 
mkdir -p /aws && 
apk -Uuv add groff less python py-pip && 
pip install awscli && 
apk --purge -v del py-pip && 
rm /var/cache/apk/*
WORKDIR /aws
ENTRYPOINT ["aws"]
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
$ alias aws="docker run -v $HOME:/root -v `pwd`:/workdir
pahud/awscli:latest”
$ aws sts get-caller-identity
{
"Account": "901234567890",
"UserId": "AIDAJVHX3XBRH4AFDCYHS",
"Arn": "arn:aws:iam::901234567890:user/pahud"
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Can I use AWS CLI in Lambda?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
https://github.com/aws-samples/aws-lambda-layer-awscli
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Just 3 lines in Lambda
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Can I make my code reusable?
SAM Template
Tells AWS CloudFormation this is a
SAM template it needs to
“transform”
Creates a AWS Lambda function
with the referenced managed AWS
IAM policy, runtime, code at the
referenced zip location, and handler
as defined. Also creates an Amazon
API Gateway and takes care of all
mapping/permissions necessary
Creates a Amazon DynamoDB table
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs6.10
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
ListTable:
Type: AWS::DynamoDB::Table
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
What does a Serverless App look like
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Develop/package/deploy SAM application
$ ENV_VAR=VALUE sam local invoke FunctionName --event event.json
$ ENV_VAR=VALUE sam local start-api
$ sam package --template-file template.yaml 
--s3-bucket my-s3-bucket 
--output-template-file packaged.yaml
$ sam deploy --template-file packaged.yaml 
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND 
--stack-name my-stack-name 
--parameter-overrides Foo=bar
$ sam logs --name FunctionName --stack-name StackName --tail
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Package, Publish and Deploy
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Serverless Application Repository(SAR)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
What does a Serverless App look like
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Now your Serverless Stack looks like this
MyServerlessApp:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:903779448426:applications/my-app-name
SemanticVersion: 1.0.0
Parameters:
ClusterName: !Ref ClusterName
LambdaRoleArn: !Ref LambdaRoleArn
LambdaLayerKubectlArn: !Ref LambdaLayerKubectlArn
NodeInstanceRoleArn: !Ref NodeInstanceRoleArn
FunctionName: !Sub "eks-auth-update-hook-${AWS::StackName}"
Define Your Serverless App to Install from SAR
UpdateCM:
Type: Custom::UpdateConfigMap
Properties:
ServiceToken: !GetAtt ConfigMapUpdate.Outputs.LambdaFuncArn
Dependency Resource(s)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Reusing Your Serverless App means:
No Server + (almost) No Code !
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
How to publish to SAR
Metadata:
AWS::ServerlessRepo::Application:
Name: my-serverless-app
Description: ”My Demo Serverless App for SAR"
Author: Pahud Hsieh
SpdxLicenseId: Apache-2.0
LicenseUrl: LICENSE
ReadmeUrl: README.md
Labels: [demo','lambda','kubectl','eks', 'aws', 'kubernetes', 'k8s']
HomePageUrl: https://github.com/pahud/my-demo-sar-app
SemanticVersion: 1.0.1
SourceCodeUrl: https://github.com/pahud/my-demo-sar-app
Metadata in SAM template
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Publish SAM application to SAR
$ sam package --template-file template.yaml 
--s3-bucket my-s3-bucket 
--output-template-file packaged.yaml
$ sam publish --template-file packaged.yaml
The following metadata of application "arn:aws:serverlessrepo:us-east-
1:068896461592:applications/my-serverless-app" has been updated:
{
"Description": ”My Demo Serverless App for SAR”,
"Author": ”Pahud Hsieh"
}
Click the link below to view your application in AWS console:
https://console.aws.amazon.com/serverlessrepo/home?region=us-east-1#/published-
applications/arn:aws:serverlessrepo:us-east-1:0123456789:my-serverless-app
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
AWS Lambda Layers
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Reusing Your Lambda Layers
aws-samples/aws-lambda-layer-awscli
One-click Deployment
https://github.com/aws-samples/aws-lambda-layer-awscli
How we publish Layer into SAR
Resources:
LambdaLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: !Sub "${AWS::StackName}"
ContentUri: ./layer.zip
CompatibleRuntimes:
- provided
LicenseInfo: 'Available under the MIT-0 license.'
RetentionPolicy: Retain
#!/bin/bash
-
CONTAINER= -
CONTAINER /
CONTAINER /
exit 0
Black Belt Tip - Makefile
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Key Takeaways
1. Use JMESPath to query your AWS CLI output
2. Containerize your AWS CLI
3. Bundle AWS CLI in AWS Lambda Layer and script your Lambda in Bash
4. Publish your Serverless Layers and Apps to SAR
5. Zero server and (almost) zero code
6. Welcome to the new Serverless World
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Thank you!
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pahud Hsieh @pahudnet
hunhsieh@amazon.com
http://fb.me/pahud
Specialist SA, Serverless
Amazon Web Services

More Related Content

What's hot

Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...
Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...
Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...
Amazon Web Services
 
Getting started with robots and AWS RoboMaker - SVC208 - New York AWS Summit
Getting started with robots and AWS RoboMaker - SVC208 - New York AWS SummitGetting started with robots and AWS RoboMaker - SVC208 - New York AWS Summit
Getting started with robots and AWS RoboMaker - SVC208 - New York AWS Summit
Amazon Web Services
 
What's new in Amazon Aurora - ADB203 - Atlanta AWS Summit
What's new in Amazon Aurora - ADB203 - Atlanta AWS SummitWhat's new in Amazon Aurora - ADB203 - Atlanta AWS Summit
What's new in Amazon Aurora - ADB203 - Atlanta AWS Summit
Amazon Web Services
 
Grid computing in the cloud for Financial Services industry - CMP205-I - New ...
Grid computing in the cloud for Financial Services industry - CMP205-I - New ...Grid computing in the cloud for Financial Services industry - CMP205-I - New ...
Grid computing in the cloud for Financial Services industry - CMP205-I - New ...
Amazon Web Services
 
Increasing the value of video with machine learning & AWS Media Services - SV...
Increasing the value of video with machine learning & AWS Media Services - SV...Increasing the value of video with machine learning & AWS Media Services - SV...
Increasing the value of video with machine learning & AWS Media Services - SV...
Amazon Web Services
 
Optimize your Machine Learning workloads | AWS Summit Tel Aviv 2019
Optimize your Machine Learning workloads  | AWS Summit Tel Aviv 2019Optimize your Machine Learning workloads  | AWS Summit Tel Aviv 2019
Optimize your Machine Learning workloads | AWS Summit Tel Aviv 2019
AWS Summits
 
Best practices for running Windows workloads on AWS
Best practices for running Windows workloads on AWSBest practices for running Windows workloads on AWS
Best practices for running Windows workloads on AWS
Amazon Web Services
 
Progetta, crea e gestisci Modern Application per web e mobile su AWS
Progetta, crea e gestisci Modern Application per web e mobile su AWSProgetta, crea e gestisci Modern Application per web e mobile su AWS
Progetta, crea e gestisci Modern Application per web e mobile su AWS
Amazon Web Services
 
Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...
Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...
Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...
Amazon Web Services
 
Architetture per l'analisi di flussi di dati in tempo reale
Architetture per l'analisi di flussi di dati in tempo realeArchitetture per l'analisi di flussi di dati in tempo reale
Architetture per l'analisi di flussi di dati in tempo reale
Amazon Web Services
 
[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...
[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...
[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...
Amazon Web Services
 
Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...
Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...
Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...
Amazon Web Services
 
Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...
Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...
Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...
Amazon Web Services
 
HK-AWS-Quick-Start-Workshop
HK-AWS-Quick-Start-WorkshopHK-AWS-Quick-Start-Workshop
HK-AWS-Quick-Start-Workshop
Amazon Web Services
 
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
Amazon Web Services
 
Build scalable applications with a serverless relational database - ADB211 - ...
Build scalable applications with a serverless relational database - ADB211 - ...Build scalable applications with a serverless relational database - ADB211 - ...
Build scalable applications with a serverless relational database - ADB211 - ...
Amazon Web Services
 
What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...
What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...
What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...
Amazon Web Services
 
What's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdf
What's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdfWhat's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdf
What's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdf
Amazon Web Services
 
Deep Dive on Amazon Elastic Container Service (ECS) | AWS Summit Tel Aviv 2019
Deep Dive on Amazon Elastic Container Service (ECS)  | AWS Summit Tel Aviv 2019Deep Dive on Amazon Elastic Container Service (ECS)  | AWS Summit Tel Aviv 2019
Deep Dive on Amazon Elastic Container Service (ECS) | AWS Summit Tel Aviv 2019
AWS Summits
 
ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...
ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...
ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...
Amazon Web Services
 

What's hot (20)

Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...
Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...
Developing-Effective-Mass-Migration-Strategy-out-of-a-Tool-based-Portfolio-As...
 
Getting started with robots and AWS RoboMaker - SVC208 - New York AWS Summit
Getting started with robots and AWS RoboMaker - SVC208 - New York AWS SummitGetting started with robots and AWS RoboMaker - SVC208 - New York AWS Summit
Getting started with robots and AWS RoboMaker - SVC208 - New York AWS Summit
 
What's new in Amazon Aurora - ADB203 - Atlanta AWS Summit
What's new in Amazon Aurora - ADB203 - Atlanta AWS SummitWhat's new in Amazon Aurora - ADB203 - Atlanta AWS Summit
What's new in Amazon Aurora - ADB203 - Atlanta AWS Summit
 
Grid computing in the cloud for Financial Services industry - CMP205-I - New ...
Grid computing in the cloud for Financial Services industry - CMP205-I - New ...Grid computing in the cloud for Financial Services industry - CMP205-I - New ...
Grid computing in the cloud for Financial Services industry - CMP205-I - New ...
 
Increasing the value of video with machine learning & AWS Media Services - SV...
Increasing the value of video with machine learning & AWS Media Services - SV...Increasing the value of video with machine learning & AWS Media Services - SV...
Increasing the value of video with machine learning & AWS Media Services - SV...
 
Optimize your Machine Learning workloads | AWS Summit Tel Aviv 2019
Optimize your Machine Learning workloads  | AWS Summit Tel Aviv 2019Optimize your Machine Learning workloads  | AWS Summit Tel Aviv 2019
Optimize your Machine Learning workloads | AWS Summit Tel Aviv 2019
 
Best practices for running Windows workloads on AWS
Best practices for running Windows workloads on AWSBest practices for running Windows workloads on AWS
Best practices for running Windows workloads on AWS
 
Progetta, crea e gestisci Modern Application per web e mobile su AWS
Progetta, crea e gestisci Modern Application per web e mobile su AWSProgetta, crea e gestisci Modern Application per web e mobile su AWS
Progetta, crea e gestisci Modern Application per web e mobile su AWS
 
Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...
Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...
Amazon EC2 A1 instances, powered by the AWS Graviton processor - CMP303 - San...
 
Architetture per l'analisi di flussi di dati in tempo reale
Architetture per l'analisi di flussi di dati in tempo realeArchitetture per l'analisi di flussi di dati in tempo reale
Architetture per l'analisi di flussi di dati in tempo reale
 
[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...
[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...
[REPEAT] Optimize your workloads with Amazon EC2 & AMD EPYC - DEM01-R - Santa...
 
Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...
Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...
Train once, deploy anywhere on the cloud and at the edge with Amazon SageMake...
 
Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...
Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...
Build intelligent applications quickly with AWS AI services - AIM301 - New Yo...
 
HK-AWS-Quick-Start-Workshop
HK-AWS-Quick-Start-WorkshopHK-AWS-Quick-Start-Workshop
HK-AWS-Quick-Start-Workshop
 
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
[NEW LAUNCH!] Introducti[NEW LAUNCH!] Introduction to event-driven architectu...
 
Build scalable applications with a serverless relational database - ADB211 - ...
Build scalable applications with a serverless relational database - ADB211 - ...Build scalable applications with a serverless relational database - ADB211 - ...
Build scalable applications with a serverless relational database - ADB211 - ...
 
What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...
What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...
What’s new with Amazon Redshift, featuring ZS Associates - ADB205 - Chicago A...
 
What's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdf
What's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdfWhat's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdf
What's new in Amazon Aurora - ADB204 - Santa Clara AWS Summit.pdf
 
Deep Dive on Amazon Elastic Container Service (ECS) | AWS Summit Tel Aviv 2019
Deep Dive on Amazon Elastic Container Service (ECS)  | AWS Summit Tel Aviv 2019Deep Dive on Amazon Elastic Container Service (ECS)  | AWS Summit Tel Aviv 2019
Deep Dive on Amazon Elastic Container Service (ECS) | AWS Summit Tel Aviv 2019
 
ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...
ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...
ML for every developer and data scientist with Amazon SageMaker - AIM201 - At...
 

Similar to Pro-Tips-for-Builders-on-AWS

Serverless Functions Deep Dive
Serverless Functions Deep DiveServerless Functions Deep Dive
Serverless Functions Deep Dive
Amazon Web Services
 
How to build a FullStack Airline Ticketing Web App.pdf
How to build a FullStack Airline Ticketing Web App.pdfHow to build a FullStack Airline Ticketing Web App.pdf
How to build a FullStack Airline Ticketing Web App.pdf
Amazon Web Services
 
Serverless APIs and you
Serverless APIs and youServerless APIs and you
Serverless APIs and you
James Beswick
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
AWS Summits
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Amazon Web Services
 
Serverless functions deep dive
Serverless functions deep diveServerless functions deep dive
Serverless functions deep dive
Amazon Web Services
 
Serverless days Stockholm - How to build a full-stack airline ticketing web app
Serverless days Stockholm - How to build a full-stack airline ticketing web appServerless days Stockholm - How to build a full-stack airline ticketing web app
Serverless days Stockholm - How to build a full-stack airline ticketing web app
Heitor Lessa
 
20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...
20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...
20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...
Amazon Web Services Japan
 
How AWS builds Serverless services using Serverless
How AWS builds Serverless services using ServerlessHow AWS builds Serverless services using Serverless
How AWS builds Serverless services using Serverless
Chris Munns
 
Meet AWS SAM
Meet AWS SAMMeet AWS SAM
Meet AWS SAM
Eric Johnson
 
ArmadaJS - how to build a full-stack airline ticketing web app
ArmadaJS - how to build a full-stack airline ticketing web appArmadaJS - how to build a full-stack airline ticketing web app
ArmadaJS - how to build a full-stack airline ticketing web app
Heitor Lessa
 
Enhancing Your Developer eXperience on AWS - AWS Summit Sydney
Enhancing Your Developer eXperience on AWS - AWS Summit SydneyEnhancing Your Developer eXperience on AWS - AWS Summit Sydney
Enhancing Your Developer eXperience on AWS - AWS Summit Sydney
Amazon Web Services
 
GraphQL backend with AWS AppSync & AWS Lambda
GraphQL backend with AWS AppSync & AWS LambdaGraphQL backend with AWS AppSync & AWS Lambda
GraphQL backend with AWS AppSync & AWS Lambda
Aleksandr Maklakov
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
Amazon Web Services
 
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Amazon Web Services
 
Security at the Speed of Cloud How to Think About it & How You Can Do it Now
Security at the Speed of Cloud How to Think About it & How You Can Do it NowSecurity at the Speed of Cloud How to Think About it & How You Can Do it Now
Security at the Speed of Cloud How to Think About it & How You Can Do it Now
Amazon Web Services
 
Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...
Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...
Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...
Amazon Web Services
 
Websites go Serverless - AWS Summit Berlin
Websites go Serverless - AWS Summit BerlinWebsites go Serverless - AWS Summit Berlin
Websites go Serverless - AWS Summit Berlin
Boaz Ziniman
 
AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...
AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...
AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...
Amazon Web Services
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
AWS Germany
 

Similar to Pro-Tips-for-Builders-on-AWS (20)

Serverless Functions Deep Dive
Serverless Functions Deep DiveServerless Functions Deep Dive
Serverless Functions Deep Dive
 
How to build a FullStack Airline Ticketing Web App.pdf
How to build a FullStack Airline Ticketing Web App.pdfHow to build a FullStack Airline Ticketing Web App.pdf
How to build a FullStack Airline Ticketing Web App.pdf
 
Serverless APIs and you
Serverless APIs and youServerless APIs and you
Serverless APIs and you
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
 
Serverless functions deep dive
Serverless functions deep diveServerless functions deep dive
Serverless functions deep dive
 
Serverless days Stockholm - How to build a full-stack airline ticketing web app
Serverless days Stockholm - How to build a full-stack airline ticketing web appServerless days Stockholm - How to build a full-stack airline ticketing web app
Serverless days Stockholm - How to build a full-stack airline ticketing web app
 
20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...
20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...
20190402 AWS Black Belt Online Seminar Let's Dive Deep into AWS Lambda Part1 ...
 
How AWS builds Serverless services using Serverless
How AWS builds Serverless services using ServerlessHow AWS builds Serverless services using Serverless
How AWS builds Serverless services using Serverless
 
Meet AWS SAM
Meet AWS SAMMeet AWS SAM
Meet AWS SAM
 
ArmadaJS - how to build a full-stack airline ticketing web app
ArmadaJS - how to build a full-stack airline ticketing web appArmadaJS - how to build a full-stack airline ticketing web app
ArmadaJS - how to build a full-stack airline ticketing web app
 
Enhancing Your Developer eXperience on AWS - AWS Summit Sydney
Enhancing Your Developer eXperience on AWS - AWS Summit SydneyEnhancing Your Developer eXperience on AWS - AWS Summit Sydney
Enhancing Your Developer eXperience on AWS - AWS Summit Sydney
 
GraphQL backend with AWS AppSync & AWS Lambda
GraphQL backend with AWS AppSync & AWS LambdaGraphQL backend with AWS AppSync & AWS Lambda
GraphQL backend with AWS AppSync & AWS Lambda
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
Best Practices for CI/CD with AWS Lambda and Amazon API Gateway (SRV355-R1) -...
 
Security at the Speed of Cloud How to Think About it & How You Can Do it Now
Security at the Speed of Cloud How to Think About it & How You Can Do it NowSecurity at the Speed of Cloud How to Think About it & How You Can Do it Now
Security at the Speed of Cloud How to Think About it & How You Can Do it Now
 
Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...
Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...
Automate Your Alexa Lambda Function Deployment Workflows Using AWS CodeCommit...
 
Websites go Serverless - AWS Summit Berlin
Websites go Serverless - AWS Summit BerlinWebsites go Serverless - AWS Summit Berlin
Websites go Serverless - AWS Summit Berlin
 
AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...
AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...
AWS identity services: Enabling and securing your cloud journey - SEC203 - Ne...
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
Amazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
Amazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
Amazon Web Services
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Amazon Web Services
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
Amazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
Amazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Amazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
Amazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Amazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
Amazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Pro-Tips-for-Builders-on-AWS

  • 1. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Pro Tips for Builders on AWS Pahud Hsieh Specialist SA, Serverless Amazon Web Services
  • 2. A little bit about me • Serverless Specialist SA, GCR • Focus on Serverless, Container and DevOps • Father of a 5-year-old daughter • Was Living in Shanghai 2006-2012 • Fan of road trip. Been to Siberia, Balkans, India, Cuba and Svalbard
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T AWS CLI
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Why we love the CLI
  • 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T JMESPath
  • 6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T $ aws ec2 describe-regions $ aws ec2 describe-regions --query 'Regions[*].RegionName'
  • 7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T $ aws ec2 describe-regions --query 'Regions[?starts_with(RegionName, `us`)].RegionName'
  • 8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T $ aws ec2 describe-regions --query 'Regions[?starts_with(RegionName, `us`)].RegionName’ --output table
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T # assign $regions as bash array $ # number of regions $ echo ${#regions[@]} # for loop processing $ for r in ${regions[@]} do custom_process_logic $r done
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Who am I?
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T $ aws sts get-caller-identity { "Account": "901234567890", "UserId": "AIDAJVHX3XBRH4AFDCYHS", "Arn": "arn:aws:iam::901234567890:user/pahud" }
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Assume-Role
  • 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T $ cat ~/.aws/config [default] region = us-west-2 [profile devops] source_profile = default role_arn = arn:aws:iam::643758553812:role/AdminRole4Switch
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T $ aws --profile devops sts get-caller-identity { "Account": "643758553812", "UserId": "AROAI4IWAM5EDVG5YGZ1W:botocore-session- 1561296250", "Arn": "arn:aws:sts::643758553812:assumed- role/AdminRole4Switch/botocore-session-1561296250" }
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T AWS CLI in Docker
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T FROM alpine:latest RUN mkdir -p /aws && apk -Uuv add groff less python py-pip && pip install awscli && apk --purge -v del py-pip && rm /var/cache/apk/* WORKDIR /aws ENTRYPOINT ["aws"]
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T $ alias aws="docker run -v $HOME:/root -v `pwd`:/workdir pahud/awscli:latest” $ aws sts get-caller-identity { "Account": "901234567890", "UserId": "AIDAJVHX3XBRH4AFDCYHS", "Arn": "arn:aws:iam::901234567890:user/pahud" }
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Can I use AWS CLI in Lambda?
  • 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T https://github.com/aws-samples/aws-lambda-layer-awscli
  • 20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Just 3 lines in Lambda
  • 21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Can I make my code reusable?
  • 22. SAM Template Tells AWS CloudFormation this is a SAM template it needs to “transform” Creates a AWS Lambda function with the referenced managed AWS IAM policy, runtime, code at the referenced zip location, and handler as defined. Also creates an Amazon API Gateway and takes care of all mapping/permissions necessary Creates a Amazon DynamoDB table AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://sam-demo-bucket/todo_list.zip Handler: index.gethtml Runtime: nodejs6.10 Policies: AmazonDynamoDBReadOnlyAccess Events: GetHtml: Type: Api Properties: Path: /{proxy+} Method: ANY ListTable: Type: AWS::DynamoDB::Table
  • 23. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T What does a Serverless App look like
  • 24. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Develop/package/deploy SAM application $ ENV_VAR=VALUE sam local invoke FunctionName --event event.json $ ENV_VAR=VALUE sam local start-api $ sam package --template-file template.yaml --s3-bucket my-s3-bucket --output-template-file packaged.yaml $ sam deploy --template-file packaged.yaml --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND --stack-name my-stack-name --parameter-overrides Foo=bar $ sam logs --name FunctionName --stack-name StackName --tail
  • 25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Package, Publish and Deploy
  • 26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Serverless Application Repository(SAR)
  • 27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T What does a Serverless App look like
  • 28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Now your Serverless Stack looks like this
  • 29. MyServerlessApp: Type: AWS::Serverless::Application Properties: Location: ApplicationId: arn:aws:serverlessrepo:us-east-1:903779448426:applications/my-app-name SemanticVersion: 1.0.0 Parameters: ClusterName: !Ref ClusterName LambdaRoleArn: !Ref LambdaRoleArn LambdaLayerKubectlArn: !Ref LambdaLayerKubectlArn NodeInstanceRoleArn: !Ref NodeInstanceRoleArn FunctionName: !Sub "eks-auth-update-hook-${AWS::StackName}" Define Your Serverless App to Install from SAR
  • 30. UpdateCM: Type: Custom::UpdateConfigMap Properties: ServiceToken: !GetAtt ConfigMapUpdate.Outputs.LambdaFuncArn Dependency Resource(s)
  • 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Reusing Your Serverless App means: No Server + (almost) No Code !
  • 32. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T How to publish to SAR
  • 33. Metadata: AWS::ServerlessRepo::Application: Name: my-serverless-app Description: ”My Demo Serverless App for SAR" Author: Pahud Hsieh SpdxLicenseId: Apache-2.0 LicenseUrl: LICENSE ReadmeUrl: README.md Labels: [demo','lambda','kubectl','eks', 'aws', 'kubernetes', 'k8s'] HomePageUrl: https://github.com/pahud/my-demo-sar-app SemanticVersion: 1.0.1 SourceCodeUrl: https://github.com/pahud/my-demo-sar-app Metadata in SAM template
  • 34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Publish SAM application to SAR $ sam package --template-file template.yaml --s3-bucket my-s3-bucket --output-template-file packaged.yaml $ sam publish --template-file packaged.yaml The following metadata of application "arn:aws:serverlessrepo:us-east- 1:068896461592:applications/my-serverless-app" has been updated: { "Description": ”My Demo Serverless App for SAR”, "Author": ”Pahud Hsieh" } Click the link below to view your application in AWS console: https://console.aws.amazon.com/serverlessrepo/home?region=us-east-1#/published- applications/arn:aws:serverlessrepo:us-east-1:0123456789:my-serverless-app
  • 35. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T AWS Lambda Layers
  • 36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Reusing Your Lambda Layers
  • 39. How we publish Layer into SAR
  • 40. Resources: LambdaLayer: Type: AWS::Serverless::LayerVersion Properties: LayerName: !Sub "${AWS::StackName}" ContentUri: ./layer.zip CompatibleRuntimes: - provided LicenseInfo: 'Available under the MIT-0 license.' RetentionPolicy: Retain
  • 41.
  • 43. Black Belt Tip - Makefile
  • 44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  • 45. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Key Takeaways 1. Use JMESPath to query your AWS CLI output 2. Containerize your AWS CLI 3. Bundle AWS CLI in AWS Lambda Layer and script your Lambda in Bash 4. Publish your Serverless Layers and Apps to SAR 5. Zero server and (almost) zero code 6. Welcome to the new Serverless World
  • 46. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Pahud Hsieh @pahudnet hunhsieh@amazon.com http://fb.me/pahud Specialist SA, Serverless Amazon Web Services