SlideShare a Scribd company logo
1 of 50
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Stack Mastery:
C r e a t e a n d O p t i m i z e A d v a n c e d A W S C l o u d F o r m a t i o n T e m p l a t e s
N o v e m b e r 2 9 , 2 0 1 7
D E V 3 3 6
Santiago Cardenas
Partner Solutions Architect
AWS Quick Start
Ian Scofield
Partner Solutions Architect
Emerging Partners
AWS re:INVENT
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Continuous improvement
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
A day in the life of IT
Discover
TryDeploy
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Wide spectrum of AWS Quick Starts
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 1 stepSign up, sign in
• 2 stepsChoose region and key pair
• 4 stepsCreate Amazon VPC
• 4 stepsCreate Internet gateway
• 24 stepsCreate 12 subnets
• 24 stepsCreate 4 NACLs
• 16 stepsCreate 4 NAT gateways
• 27 stepsCreate 9 route tables
• 2 stepsCreate routes
• Many more stepsAdd more stacks
Sign up, sign in
Choose region and
key pair
Launch AWS Quick
Start
Reducing complexity
Manual deployment VPC AWS Quick Start
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Plan
and
Design
Build
and
Test
Optimize
and
Enhance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Plan and design
your architecture
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Secure Reliable Performant Efficient
Attributes of great architectures
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Build and test
your deployment
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Recurring themes
Scripting Orchestration Source control
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Gives developers and systems administrators
an easy way to create and manage a collection
of related AWS resources
Understands dependencies and supports
rollbacks and versioning
Allows for reusable component design
strategies
Supports JSON and YAML formats
AWS CloudFormation
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CloudFormation concepts
Template Change SetStack
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CloudFormation concepts
Template Stack Set
Stack Stack
Stack Stack
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
An AWS CloudFormation stack is a
single unit used to manage related
resources
You can create, update, and delete
resources by creating, updating, and
deleting stacks
Stacks are created from templates
Change sets allow you to edit your
stacks
Virtually every kind of AWS resource can
be managed via stacks
It’s all about the stacks
Stack
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Optimize and enhance
your deployment
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Maintainable Flexible Reusable Standardized
Attributes of great templates
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
You can build a new AWS infrastructure for
your Magento stack
Deploy Magento into your existing AWS
infrastructure
Choice of Amazon Aurora or MySQL on
Amazon RDS for database operations
Amazon Elastic File System (Amazon EFS)
for shared storage between Amazon
Elastic Compute Cloud (Amazon EC2)
instances
Amazon ElastiCache cluster with the Redis
cache engine to improve application load
times
Magento Open Source Quick Start
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Housekeeping
Dashboard to access your AWS
account
• “Starter” lab files
• “Final” versions of the previous
lab
You should have an index card
with a code on it
Labs warning: you may not be able to complete the labs in the allotted time, but don’t worry—we
will give you the final files to follow along and to dive deeper and explore at home
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Low-hanging fruit
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Parameters
Provide values to your template
Create templates that are
customized each time you create a
stack
Add validation like:
• MinLength/MaxLength
• AllowedPattern (regex)
• AllowedValues
Hide values with NoEcho
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Parameters—types
String
Number
List
CommaDelimitedList
AWS-specific parameter types like:
• AWS::EC2::AvailabilityZone::Name
• AWS::EC2::KeyPair::KeyName
• AWS::EC2::VPC::Id
AWS::EC2::AvailabilityZone::Name
AWS::EC2::KeyPair::KeyName
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Parameters—not so human-friendly
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Parameters—ah, that’s better
Groups
Labels
Descriptions
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s launch our stack
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CREATE_FAILED
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rules:
SubnetsInVPC:
Assertions:
- Assert:
Fn::EachMemberIn:
- Fn::ValueOfAll:
- AWS::EC2::Subnet::Id
- VpcId
- Fn::RefAll: AWS::EC2::VPC::Id
AssertDescription: All subnets must in the VPC
Gives you the ability to validate entries
before launching the template
Saves time and frustration
Examples:
• Subnets in VPC
• Key pairs not blank
• Service support (Amazon Aurora and
Amazon EFS)
Template constraints (rules)
AWS Service Catalog
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AMI mappings
...
Mappings:
AWSAMIRegionMap:
AMI:
AMZNLINUXHVM: amzn-ami-hvm-2017.03.0.20170417-x86_64-gp2
CENTOS7HVM: CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-...
US1604HVM: ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170516
ap-northeast-1:
AMZNLINUXHVM: ami-923d12f5
CENTOS7HVM: ami-29d1e34e
US1604HVM: ami-1de1df7a
ap-northeast-2:
AMZNLINUXHVM: ami-9d15c7f3
CENTOS7HVM: ami-08e93466
US1604HVM: ami-6722ff09
...
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 1 time (30 mins)
Objectives:
1. Create an AMI mappings section
2. Add template rules (constraints)
3. Limit parameters to allowed values
4. Extra credit: create groups and labels
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Stackception
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Splitting into reusable modules
Identify common components, such as:
• Amazon VPC
• Bastion access
Then take a look at your application:
• Database
• Caching
• Web servers
…Pull these pieces out
Why?
• Reusability
• Easier to maintain/collaborate
• Version control
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Avoid named resources
Certain resources can allow you to specify a name,
for example:
• Amazon S3 buckets
• IAM roles
• Amazon SNS topics
You lose the ability to perform updates on your
stack if the resource requires replacement
Can’t launch multiple instances of your stack
Let AWS CloudFormation name your resources
Flexible
Reusable
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Stack nesting
We have our application broken into pieces,
but we need a way to put them together
Nested stacks!
Orchestration template launches all of the
individual components
Helps you get around stack limits like length
Orchestration
Web ServersDatabase
VPC
Caching
Bastion
Access
Workload
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 2 time (10 mins)
Objectives:
1. Create a master template which orchestrates the entire stack
A. Use the starter orchestration template
B. Use the URLs from the dashboard
Lab 1 final templates are now available for download
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CloudFormation building blocks
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Built-in functions to help you manage
your stacks
Assign values to properties not available
at runtime
Conditionally create stack resources
Used in resource properties, outputs,
metadata attributes, and update policy
attributes
Fn::Base64
Fn::FindInMap
Ref
Fn::GetAtt
Fn::GetAZs
Fn::ImportValue
Fn::Join
Fn::Split
Fn::Select
Fn::Sub
Fn::If, And, Or, Not, Equals
Intrinsic functions
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fn::Join as opposed to Fn::Sub
UserData:
Fn::Base64:
Fn::Join:
- ''
- - '#!/bin/bashn'
- 'cfn-init -v -s '
- Ref: AWS::StackName
- ' -r ResourceName --region '
- Ref: AWS::Region
- 'n'
- 'cfn-signal -e $? -s '
- Ref: AWS::StackName
- ' -r ResourceName --region '
- Ref: AWS::Region
- 'n'
...
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fn::Join as opposed to Fn::Sub
UserData:
Fn::Base64:
Fn::Sub: |
#!/bin/bash
cfn-init -v -s ${AWS::StackName} -r ResourceName --region ${AWS::Region}
cfn-signal -e $? -s ${AWS::StackName} -r ResourceName --region ${AWS::Region}
...
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
cfn-init
Enables a variety of scripting languages for bootstrapping
Credentials are specified in AWS::CloudFormation::Authentication
Configuration is specified in AWS::CloudFormation::Init
Executes as root (Linux)/Local System (Windows)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example authentication section
Metadata:
...
AWS::CloudFormation::Authentication:
S3AccessCreds:
type: S3
roleName:
Ref: SomeHostRole
buckets:
-Ref: QSS3BucketName
... Optional…used with
cfn-init sources
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example Linux init files
Metadata:
AWS::CloudFormation::Init:
config:
files:
/tmp/some_script.sh:
source:
Fn::Sub:
https://${QSS3BucketName}.s3.amazonaws.com/${QSS3KeyPrefix}scripts/script.sh
mode: '000550'
owner: root
group: root
authentication: S3AccessCreds
...
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example Linux init commands
Metadata:
AWS::CloudFormation::Init:
config:
files:
...
commands:
do_first_thing:
command:
Fn::Sub: /tmp/some_script.sh --parameter ${ParameterFromTemplate}
do_second_thing:
command: touch /tmp/some_file
...
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 3 time (20 mins)
Objectives:
1. Convert Fn::Join functions to Fn::Sub functions
2. Add a metadata section for cfn-init and include:
AWS::CloudFormation::Authentication
AWS::CloudFormation::Init
Relative paths using Fn::Sub
Lab 2 final templates are now available for download
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Enhance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
From instance to Auto Scaling group
AMI AWS::AutoScaling::LaunchConfiguration
AWS::EC2::Instance
AWS::AutoScaling::AutoScalingGroup
AWS::AutoScaling::ScalingPolicy
AWS::AutoScaling::ScheduledAction
AWS::AutoScaling::LifecycleHook
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Load balancing
AWS::ElasticLoadBalancingV2::LoadBalancer
(or AWS::ElasticLoadBalancing::LoadBalancer)
AWS::AutoScaling::AutoScalingGroup
TargetGroupARNs
(or LoadbalancerNames)
Application
Load
Balancer
Network
Load
Balancer
Classic
Load
Balancer
AWS::ElasticLoadBalancingV2::TargetGroup
AWS::ElasticLoadBalancingV2::Listener
AWS::ElasticLoadBalancingV2::ListenerRule
AWS::ElasticLoadBalancingV2::ListenerCertificate
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MySQL to Amazon Aurora
AWS::EC2::Instance
+
Database
AWS::RDS::DBInstance AWS::RDS::Cluster
+
AWS::RDS::DBInstances
Lower performance Higher performance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EFS for shared storage
AWS::EFS::FileSystem
AWS::EFS::MountTarget AWS::EFS::MountTarget
NFS
Server
Volume Volume
NFS
Server
Volume Volume
NFS
Clients Clients Clients
NFS
Clients
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 4 time (20 mins)
Objectives:
1. Convert web server instance to Auto Scaling group
2. Review:
A. Elastic Load Balancing
B. Amazon Aurora
C. Amazon EFS
Lab 3 final templates are now available for download
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Secure Reliable Performant Efficient
Scripting Orchestration Source
control
Maintainable Flexible Reusable Standardized
Plan
and
Design
Build
and
Test
Optimize
and
Enhance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!

More Related Content

What's hot

What's hot (20)

Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
Using AWS Management Tools to Enable Governance, Compliance, Operational, and...
 
Automate and Scale Configuration Management with AWS OpsWorks - DEV331 - re:I...
Automate and Scale Configuration Management with AWS OpsWorks - DEV331 - re:I...Automate and Scale Configuration Management with AWS OpsWorks - DEV331 - re:I...
Automate and Scale Configuration Management with AWS OpsWorks - DEV331 - re:I...
 
(SOV204) Scaling Up to Your First 10 Million Users | AWS re:Invent 2014
(SOV204) Scaling Up to Your First 10 Million Users | AWS re:Invent 2014(SOV204) Scaling Up to Your First 10 Million Users | AWS re:Invent 2014
(SOV204) Scaling Up to Your First 10 Million Users | AWS re:Invent 2014
 
Serverless Developer Experience
Serverless Developer ExperienceServerless Developer Experience
Serverless Developer Experience
 
Managing Windows Containers on ECS
Managing Windows Containers on ECSManaging Windows Containers on ECS
Managing Windows Containers on ECS
 
Optimising Cost and Efficiency on AWS
Optimising Cost and Efficiency on AWSOptimising Cost and Efficiency on AWS
Optimising Cost and Efficiency on AWS
 
Architecting-for-the-cloud-Best-Practices
Architecting-for-the-cloud-Best-PracticesArchitecting-for-the-cloud-Best-Practices
Architecting-for-the-cloud-Best-Practices
 
Interstella GTC: Monolith to Microservices with ECS
Interstella GTC: Monolith to Microservices with ECSInterstella GTC: Monolith to Microservices with ECS
Interstella GTC: Monolith to Microservices with ECS
 
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Containers & Microservices
IVS CTO Night And Day 2018 Winter - [re:Cap] Containers & MicroservicesIVS CTO Night And Day 2018 Winter - [re:Cap] Containers & Microservices
IVS CTO Night And Day 2018 Winter - [re:Cap] Containers & Microservices
 
Amazon EC2 and Amazon VPC Hands-on Workshop
Amazon EC2 and Amazon VPC Hands-on WorkshopAmazon EC2 and Amazon VPC Hands-on Workshop
Amazon EC2 and Amazon VPC Hands-on Workshop
 
Deep Dive into Amazon ECS & Fargate
Deep Dive into Amazon ECS & FargateDeep Dive into Amazon ECS & Fargate
Deep Dive into Amazon ECS & Fargate
 
STG206_Big Data Data Lakes and Data Oceans
STG206_Big Data Data Lakes and Data OceansSTG206_Big Data Data Lakes and Data Oceans
STG206_Big Data Data Lakes and Data Oceans
 
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
Workshop: Building Serverless Real-time Data Processing (Now with Unicorns!)
 
Amazon EFS (Elastic File System) 이해하고사용하기
Amazon EFS (Elastic File System) 이해하고사용하기Amazon EFS (Elastic File System) 이해하고사용하기
Amazon EFS (Elastic File System) 이해하고사용하기
 
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
 
SRV334-Making Things Right with AWS Config Rules and AWS Lambda
SRV334-Making Things Right with AWS Config Rules and AWS LambdaSRV334-Making Things Right with AWS Config Rules and AWS Lambda
SRV334-Making Things Right with AWS Config Rules and AWS Lambda
 
AWSome Day Digital LATAM
AWSome Day Digital LATAMAWSome Day Digital LATAM
AWSome Day Digital LATAM
 
DEV205_Developing Applications on AWS in the JVM
DEV205_Developing Applications on AWS in the JVMDEV205_Developing Applications on AWS in the JVM
DEV205_Developing Applications on AWS in the JVM
 
EC2 and VPC Workshop
EC2 and VPC WorkshopEC2 and VPC Workshop
EC2 and VPC Workshop
 

Similar to Stack Mastery: Create and Optimize Advanced AWS CloudFormation Templates - DEV336 - re:Invent 2017

Similar to Stack Mastery: Create and Optimize Advanced AWS CloudFormation Templates - DEV336 - re:Invent 2017 (20)

Amazon ECS Deep Dive
Amazon ECS Deep DiveAmazon ECS Deep Dive
Amazon ECS Deep Dive
 
Amazon Amazon Elastic Container Service (Amazon ECS)
Amazon Amazon Elastic Container Service (Amazon ECS)Amazon Amazon Elastic Container Service (Amazon ECS)
Amazon Amazon Elastic Container Service (Amazon ECS)
 
Deep Dive on Amazon Elastic Container Service (ECS) and Fargate
Deep Dive on Amazon Elastic Container Service (ECS) and FargateDeep Dive on Amazon Elastic Container Service (ECS) and Fargate
Deep Dive on Amazon Elastic Container Service (ECS) and Fargate
 
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
 
ARC205_Born in the Cloud
ARC205_Born in the CloudARC205_Born in the Cloud
ARC205_Born in the Cloud
 
Building Web Apps on AWS
Building Web Apps on AWSBuilding Web Apps on AWS
Building Web Apps on AWS
 
GPSBUS220-Refactor and Replatform .NET Apps to Use the Latest Microsoft SQL S...
GPSBUS220-Refactor and Replatform .NET Apps to Use the Latest Microsoft SQL S...GPSBUS220-Refactor and Replatform .NET Apps to Use the Latest Microsoft SQL S...
GPSBUS220-Refactor and Replatform .NET Apps to Use the Latest Microsoft SQL S...
 
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
 
Leo Zhadanovsky - Building Web Apps with AWS CodeStar and AWS Elastic Beansta...
Leo Zhadanovsky - Building Web Apps with AWS CodeStar and AWS Elastic Beansta...Leo Zhadanovsky - Building Web Apps with AWS CodeStar and AWS Elastic Beansta...
Leo Zhadanovsky - Building Web Apps with AWS CodeStar and AWS Elastic Beansta...
 
Moving to Amazon ECS – the Not-So-Obvious Benefits - CON356 - re:Invent 2017
Moving to Amazon ECS – the Not-So-Obvious Benefits - CON356 - re:Invent 2017Moving to Amazon ECS – the Not-So-Obvious Benefits - CON356 - re:Invent 2017
Moving to Amazon ECS – the Not-So-Obvious Benefits - CON356 - re:Invent 2017
 
Amazon EC2 and Amazon VPC Hands-On Workshop
Amazon EC2 and Amazon VPC Hands-On WorkshopAmazon EC2 and Amazon VPC Hands-On Workshop
Amazon EC2 and Amazon VPC Hands-On Workshop
 
Building Manageable Windows Workloads - ARC324 - re:Invent 2017
Building Manageable Windows Workloads - ARC324 - re:Invent 2017Building Manageable Windows Workloads - ARC324 - re:Invent 2017
Building Manageable Windows Workloads - ARC324 - re:Invent 2017
 
Born in the Cloud, Built like a Startup
Born in the Cloud, Built like a StartupBorn in the Cloud, Built like a Startup
Born in the Cloud, Built like a Startup
 
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
 
CON319_Interstella GTC CICD for Containers on AWS
CON319_Interstella GTC CICD for Containers on AWSCON319_Interstella GTC CICD for Containers on AWS
CON319_Interstella GTC CICD for Containers on AWS
 
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
透過最新的 AWS 服務在 2019 年為您的業務轉型 (Level 200)
 
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
 
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
 
LFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdfLFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdf
 

More from 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
 
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
 

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
 

Stack Mastery: Create and Optimize Advanced AWS CloudFormation Templates - DEV336 - re:Invent 2017

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Stack Mastery: C r e a t e a n d O p t i m i z e A d v a n c e d A W S C l o u d F o r m a t i o n T e m p l a t e s N o v e m b e r 2 9 , 2 0 1 7 D E V 3 3 6 Santiago Cardenas Partner Solutions Architect AWS Quick Start Ian Scofield Partner Solutions Architect Emerging Partners AWS re:INVENT
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Continuous improvement
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. A day in the life of IT Discover TryDeploy
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Wide spectrum of AWS Quick Starts
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • 1 stepSign up, sign in • 2 stepsChoose region and key pair • 4 stepsCreate Amazon VPC • 4 stepsCreate Internet gateway • 24 stepsCreate 12 subnets • 24 stepsCreate 4 NACLs • 16 stepsCreate 4 NAT gateways • 27 stepsCreate 9 route tables • 2 stepsCreate routes • Many more stepsAdd more stacks Sign up, sign in Choose region and key pair Launch AWS Quick Start Reducing complexity Manual deployment VPC AWS Quick Start
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Plan and Design Build and Test Optimize and Enhance
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Plan and design your architecture
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Secure Reliable Performant Efficient Attributes of great architectures
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Build and test your deployment
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Recurring themes Scripting Orchestration Source control
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Gives developers and systems administrators an easy way to create and manage a collection of related AWS resources Understands dependencies and supports rollbacks and versioning Allows for reusable component design strategies Supports JSON and YAML formats AWS CloudFormation
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CloudFormation concepts Template Change SetStack
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CloudFormation concepts Template Stack Set Stack Stack Stack Stack
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. An AWS CloudFormation stack is a single unit used to manage related resources You can create, update, and delete resources by creating, updating, and deleting stacks Stacks are created from templates Change sets allow you to edit your stacks Virtually every kind of AWS resource can be managed via stacks It’s all about the stacks Stack
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Optimize and enhance your deployment
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Maintainable Flexible Reusable Standardized Attributes of great templates
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. You can build a new AWS infrastructure for your Magento stack Deploy Magento into your existing AWS infrastructure Choice of Amazon Aurora or MySQL on Amazon RDS for database operations Amazon Elastic File System (Amazon EFS) for shared storage between Amazon Elastic Compute Cloud (Amazon EC2) instances Amazon ElastiCache cluster with the Redis cache engine to improve application load times Magento Open Source Quick Start
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Housekeeping Dashboard to access your AWS account • “Starter” lab files • “Final” versions of the previous lab You should have an index card with a code on it Labs warning: you may not be able to complete the labs in the allotted time, but don’t worry—we will give you the final files to follow along and to dive deeper and explore at home
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Low-hanging fruit
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Parameters Provide values to your template Create templates that are customized each time you create a stack Add validation like: • MinLength/MaxLength • AllowedPattern (regex) • AllowedValues Hide values with NoEcho
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Parameters—types String Number List CommaDelimitedList AWS-specific parameter types like: • AWS::EC2::AvailabilityZone::Name • AWS::EC2::KeyPair::KeyName • AWS::EC2::VPC::Id AWS::EC2::AvailabilityZone::Name AWS::EC2::KeyPair::KeyName
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Parameters—not so human-friendly
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Parameters—ah, that’s better Groups Labels Descriptions
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Let’s launch our stack
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CREATE_FAILED
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rules: SubnetsInVPC: Assertions: - Assert: Fn::EachMemberIn: - Fn::ValueOfAll: - AWS::EC2::Subnet::Id - VpcId - Fn::RefAll: AWS::EC2::VPC::Id AssertDescription: All subnets must in the VPC Gives you the ability to validate entries before launching the template Saves time and frustration Examples: • Subnets in VPC • Key pairs not blank • Service support (Amazon Aurora and Amazon EFS) Template constraints (rules) AWS Service Catalog
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AMI mappings ... Mappings: AWSAMIRegionMap: AMI: AMZNLINUXHVM: amzn-ami-hvm-2017.03.0.20170417-x86_64-gp2 CENTOS7HVM: CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-... US1604HVM: ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170516 ap-northeast-1: AMZNLINUXHVM: ami-923d12f5 CENTOS7HVM: ami-29d1e34e US1604HVM: ami-1de1df7a ap-northeast-2: AMZNLINUXHVM: ami-9d15c7f3 CENTOS7HVM: ami-08e93466 US1604HVM: ami-6722ff09 ...
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lab 1 time (30 mins) Objectives: 1. Create an AMI mappings section 2. Add template rules (constraints) 3. Limit parameters to allowed values 4. Extra credit: create groups and labels
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Stackception
  • 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Splitting into reusable modules Identify common components, such as: • Amazon VPC • Bastion access Then take a look at your application: • Database • Caching • Web servers …Pull these pieces out Why? • Reusability • Easier to maintain/collaborate • Version control
  • 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Avoid named resources Certain resources can allow you to specify a name, for example: • Amazon S3 buckets • IAM roles • Amazon SNS topics You lose the ability to perform updates on your stack if the resource requires replacement Can’t launch multiple instances of your stack Let AWS CloudFormation name your resources Flexible Reusable
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Stack nesting We have our application broken into pieces, but we need a way to put them together Nested stacks! Orchestration template launches all of the individual components Helps you get around stack limits like length Orchestration Web ServersDatabase VPC Caching Bastion Access Workload
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lab 2 time (10 mins) Objectives: 1. Create a master template which orchestrates the entire stack A. Use the starter orchestration template B. Use the URLs from the dashboard Lab 1 final templates are now available for download
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CloudFormation building blocks
  • 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Built-in functions to help you manage your stacks Assign values to properties not available at runtime Conditionally create stack resources Used in resource properties, outputs, metadata attributes, and update policy attributes Fn::Base64 Fn::FindInMap Ref Fn::GetAtt Fn::GetAZs Fn::ImportValue Fn::Join Fn::Split Fn::Select Fn::Sub Fn::If, And, Or, Not, Equals Intrinsic functions
  • 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Fn::Join as opposed to Fn::Sub UserData: Fn::Base64: Fn::Join: - '' - - '#!/bin/bashn' - 'cfn-init -v -s ' - Ref: AWS::StackName - ' -r ResourceName --region ' - Ref: AWS::Region - 'n' - 'cfn-signal -e $? -s ' - Ref: AWS::StackName - ' -r ResourceName --region ' - Ref: AWS::Region - 'n' ...
  • 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Fn::Join as opposed to Fn::Sub UserData: Fn::Base64: Fn::Sub: | #!/bin/bash cfn-init -v -s ${AWS::StackName} -r ResourceName --region ${AWS::Region} cfn-signal -e $? -s ${AWS::StackName} -r ResourceName --region ${AWS::Region} ...
  • 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. cfn-init Enables a variety of scripting languages for bootstrapping Credentials are specified in AWS::CloudFormation::Authentication Configuration is specified in AWS::CloudFormation::Init Executes as root (Linux)/Local System (Windows)
  • 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example authentication section Metadata: ... AWS::CloudFormation::Authentication: S3AccessCreds: type: S3 roleName: Ref: SomeHostRole buckets: -Ref: QSS3BucketName ... Optional…used with cfn-init sources
  • 40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example Linux init files Metadata: AWS::CloudFormation::Init: config: files: /tmp/some_script.sh: source: Fn::Sub: https://${QSS3BucketName}.s3.amazonaws.com/${QSS3KeyPrefix}scripts/script.sh mode: '000550' owner: root group: root authentication: S3AccessCreds ...
  • 41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example Linux init commands Metadata: AWS::CloudFormation::Init: config: files: ... commands: do_first_thing: command: Fn::Sub: /tmp/some_script.sh --parameter ${ParameterFromTemplate} do_second_thing: command: touch /tmp/some_file ...
  • 42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lab 3 time (20 mins) Objectives: 1. Convert Fn::Join functions to Fn::Sub functions 2. Add a metadata section for cfn-init and include: AWS::CloudFormation::Authentication AWS::CloudFormation::Init Relative paths using Fn::Sub Lab 2 final templates are now available for download
  • 43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Enhance
  • 44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. From instance to Auto Scaling group AMI AWS::AutoScaling::LaunchConfiguration AWS::EC2::Instance AWS::AutoScaling::AutoScalingGroup AWS::AutoScaling::ScalingPolicy AWS::AutoScaling::ScheduledAction AWS::AutoScaling::LifecycleHook
  • 45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Load balancing AWS::ElasticLoadBalancingV2::LoadBalancer (or AWS::ElasticLoadBalancing::LoadBalancer) AWS::AutoScaling::AutoScalingGroup TargetGroupARNs (or LoadbalancerNames) Application Load Balancer Network Load Balancer Classic Load Balancer AWS::ElasticLoadBalancingV2::TargetGroup AWS::ElasticLoadBalancingV2::Listener AWS::ElasticLoadBalancingV2::ListenerRule AWS::ElasticLoadBalancingV2::ListenerCertificate
  • 46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MySQL to Amazon Aurora AWS::EC2::Instance + Database AWS::RDS::DBInstance AWS::RDS::Cluster + AWS::RDS::DBInstances Lower performance Higher performance
  • 47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon EFS for shared storage AWS::EFS::FileSystem AWS::EFS::MountTarget AWS::EFS::MountTarget NFS Server Volume Volume NFS Server Volume Volume NFS Clients Clients Clients NFS Clients
  • 48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lab 4 time (20 mins) Objectives: 1. Convert web server instance to Auto Scaling group 2. Review: A. Elastic Load Balancing B. Amazon Aurora C. Amazon EFS Lab 3 final templates are now available for download
  • 49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Secure Reliable Performant Efficient Scripting Orchestration Source control Maintainable Flexible Reusable Standardized Plan and Design Build and Test Optimize and Enhance
  • 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you!