SlideShare una empresa de Scribd logo
1 de 19
P U B L I C S E C T O R
S U M M I T
Washington, DC
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Introduction to the AWS Cloud
Development Kit (CDK): Opinionated
Infrastructure as Code
Ryan Malecky
Sr Solutions Architect
Amazon Web Services
3 0 9 2 6 5
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Manual
� Easy to get started
� Not reproducible
� Error prone
� Time consuming Manual
High
level
Low
level
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Scripted
� What happens if an API call fails?
� How do I make updates?
� How do I know a resource is ready?
� How do I roll back?
Scripted
Manual
High
level
Low
level
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Resource provisioning engines
AWS CloudFormation
template
(JSON/YAML)
Desired state configuration
Declarative
Scripted
Manual
High
level
Low
level
� Easy to automate
� Reproducible
� Configuration syntax
� No abstraction, lots of details
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Document Object Models (DOMs)
Troposphere Python
SparkleFormation Ruby
GoFormation Go
…
if statements, for loops, IDE
benefits
Ex: 218 lines of Troposphere for a
VPC
AWS
CloudFormati
on Template
� Real code ♥️
� Desired state
� Abstraction is not built-in
DOMs
Declarative
Scripted
Manual
High
level
Low
level
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Developer
preview
AWS
CloudFormation
template
AWS CDK application
Stack(s)
Construct Construct
AWS CDK
Componentize
d
DOMs
Declarative
Scripted
Manual
High
level
Low
level
Resources
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
AWS Construct
Library
AWS CDK Developer
preview
Componentize
d
DOMs
Declarative
Scripted
Manual
High
level
Low
level
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
AWS Cloud Development Kit (CDK)
Open source framework to define cloud infrastructure in popular
programming languages
‘By compiling our source module using jsii, we can now package it as modules in one of the supported target
languages.’
JSII (JavaScript Interoperability Interface)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
AWS Cloud Development Kit (CDK)
Provides library of higher-level resource types (“construct” classes) that
have AWS best practices built in by default
 Think constructs as cloud components
 Constructs can represent architectures of any complexity
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
AWS Cloud Development Kit (CDK)
Provisions resources with AWS CloudFormation
 Synthesize and print the CloudFormation template
 Deploy CloudFormation stacks directly
Supports all AWS CloudFormation resource types
 Create low-level resources from CloudFormation Resource Specification on a
regular basis
 Cfnxyz classes matches 1:1 with resources in CloudFormation (L1 Constructs)
 Provide high level abstraction via the AWS construct library
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
AWS construct library (L2 constructs)
• AWS Lambda
• Amazon API Gateway
• AWS DynamoDB
• AWS Step Functions
• Amazon CloudWatch
• Metrics, alarms, dashboards
• AWS CodePipeline
• AWS Auto Scaling
• Amazon Elastic Cloud Compute (Amazon EC2)
• VPCs, security groups, Auto Scaling
• ……
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
CDK workflow
cdk bootstrap - Deploys the CDK toolkit stack into an AWS environment
cdk init - Create a new CDK project
Add the constructs your code needs
e.g. npm install @aws-cdk/aws-lambda @aws-cdk/aws-apigateway
Compile your code if needed
e.g. npm run build
cdk synth - Synthesizes and prints the CloudFormation template for the stack
cdk deploy - Deploys the stack(s) into your AWS account
cdk destroy - Destroy the stack(s)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Demos
1. Workflow
2. Building an Application
3. Building a Construct
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Next steps
• Try out the CDK
• https://cdkworkshop.com
• https://docs.aws.amazon.com/cdk/api/latest/
• https://github.com/eladb/awesome-cdk
• Engage with the community
• https://github.com/awslabs/aws-cdk
• https://gitter.im/awslabs/aws-cdk
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Thank you!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R
S U M M I T
Ryan Malecky
rmalecky@amazon.com

Más contenido relacionado

Más de 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 WorkloadsAmazon 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 sfatareAmazon 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 NodeJSAmazon 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 webAmazon 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 sfatareAmazon 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 AWSAmazon 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 DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon 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 ServiceAmazon Web Services
 
Come costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWSCome costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWSAmazon Web Services
 
AWS Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei serverAWS Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei serverAmazon Web Services
 
Crea dashboard interattive con Amazon QuickSight
Crea dashboard interattive con Amazon QuickSightCrea dashboard interattive con Amazon QuickSight
Crea dashboard interattive con Amazon QuickSightAmazon Web Services
 
Costruisci modelli di Machine Learning con Amazon SageMaker Autopilot
Costruisci modelli di Machine Learning con Amazon SageMaker AutopilotCostruisci modelli di Machine Learning con Amazon SageMaker Autopilot
Costruisci modelli di Machine Learning con Amazon SageMaker AutopilotAmazon Web Services
 
Migra le tue file shares in cloud con FSx for Windows
Migra le tue file shares in cloud con FSx for Windows Migra le tue file shares in cloud con FSx for Windows
Migra le tue file shares in cloud con FSx for Windows Amazon Web Services
 
La tua organizzazione è pronta per adottare una strategia di cloud ibrido?
La tua organizzazione è pronta per adottare una strategia di cloud ibrido?La tua organizzazione è pronta per adottare una strategia di cloud ibrido?
La tua organizzazione è pronta per adottare una strategia di cloud ibrido?Amazon Web Services
 
Protect your applications from DDoS/BOT & Advanced Attacks
Protect your applications from DDoS/BOT & Advanced AttacksProtect your applications from DDoS/BOT & Advanced Attacks
Protect your applications from DDoS/BOT & Advanced AttacksAmazon Web Services
 
Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用
Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用
Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用Amazon Web Services
 

Más de Amazon Web Services (20)

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
 
Come costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWSCome costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWS
 
AWS Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei serverAWS Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei server
 
Crea dashboard interattive con Amazon QuickSight
Crea dashboard interattive con Amazon QuickSightCrea dashboard interattive con Amazon QuickSight
Crea dashboard interattive con Amazon QuickSight
 
Costruisci modelli di Machine Learning con Amazon SageMaker Autopilot
Costruisci modelli di Machine Learning con Amazon SageMaker AutopilotCostruisci modelli di Machine Learning con Amazon SageMaker Autopilot
Costruisci modelli di Machine Learning con Amazon SageMaker Autopilot
 
Migra le tue file shares in cloud con FSx for Windows
Migra le tue file shares in cloud con FSx for Windows Migra le tue file shares in cloud con FSx for Windows
Migra le tue file shares in cloud con FSx for Windows
 
La tua organizzazione è pronta per adottare una strategia di cloud ibrido?
La tua organizzazione è pronta per adottare una strategia di cloud ibrido?La tua organizzazione è pronta per adottare una strategia di cloud ibrido?
La tua organizzazione è pronta per adottare una strategia di cloud ibrido?
 
Protect your applications from DDoS/BOT & Advanced Attacks
Protect your applications from DDoS/BOT & Advanced AttacksProtect your applications from DDoS/BOT & Advanced Attacks
Protect your applications from DDoS/BOT & Advanced Attacks
 
Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用
Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用
Track 6 Session 6_ 透過 AWS AI 服務模擬、部署機器人於產業之應用
 

Introduction to the AWS Cloud Development Kit (CDK): Opinionated Infrastructure as Code

  • 1. P U B L I C S E C T O R S U M M I T Washington, DC
  • 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Introduction to the AWS Cloud Development Kit (CDK): Opinionated Infrastructure as Code Ryan Malecky Sr Solutions Architect Amazon Web Services 3 0 9 2 6 5
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Manual � Easy to get started � Not reproducible � Error prone � Time consuming Manual High level Low level
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Scripted � What happens if an API call fails? � How do I make updates? � How do I know a resource is ready? � How do I roll back? Scripted Manual High level Low level
  • 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Resource provisioning engines AWS CloudFormation template (JSON/YAML) Desired state configuration Declarative Scripted Manual High level Low level � Easy to automate � Reproducible � Configuration syntax � No abstraction, lots of details
  • 6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Document Object Models (DOMs) Troposphere Python SparkleFormation Ruby GoFormation Go … if statements, for loops, IDE benefits Ex: 218 lines of Troposphere for a VPC AWS CloudFormati on Template � Real code ♥️ � Desired state � Abstraction is not built-in DOMs Declarative Scripted Manual High level Low level
  • 7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T
  • 8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Developer preview AWS CloudFormation template AWS CDK application Stack(s) Construct Construct AWS CDK Componentize d DOMs Declarative Scripted Manual High level Low level Resources
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T AWS Construct Library AWS CDK Developer preview Componentize d DOMs Declarative Scripted Manual High level Low level
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T AWS Cloud Development Kit (CDK) Open source framework to define cloud infrastructure in popular programming languages ‘By compiling our source module using jsii, we can now package it as modules in one of the supported target languages.’ JSII (JavaScript Interoperability Interface)
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T AWS Cloud Development Kit (CDK) Provides library of higher-level resource types (“construct” classes) that have AWS best practices built in by default  Think constructs as cloud components  Constructs can represent architectures of any complexity
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T AWS Cloud Development Kit (CDK) Provisions resources with AWS CloudFormation  Synthesize and print the CloudFormation template  Deploy CloudFormation stacks directly Supports all AWS CloudFormation resource types  Create low-level resources from CloudFormation Resource Specification on a regular basis  Cfnxyz classes matches 1:1 with resources in CloudFormation (L1 Constructs)  Provide high level abstraction via the AWS construct library
  • 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T AWS construct library (L2 constructs) • AWS Lambda • Amazon API Gateway • AWS DynamoDB • AWS Step Functions • Amazon CloudWatch • Metrics, alarms, dashboards • AWS CodePipeline • AWS Auto Scaling • Amazon Elastic Cloud Compute (Amazon EC2) • VPCs, security groups, Auto Scaling • ……
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T CDK workflow cdk bootstrap - Deploys the CDK toolkit stack into an AWS environment cdk init - Create a new CDK project Add the constructs your code needs e.g. npm install @aws-cdk/aws-lambda @aws-cdk/aws-apigateway Compile your code if needed e.g. npm run build cdk synth - Synthesizes and prints the CloudFormation template for the stack cdk deploy - Deploys the stack(s) into your AWS account cdk destroy - Destroy the stack(s)
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Demos 1. Workflow 2. Building an Application 3. Building a Construct
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Next steps • Try out the CDK • https://cdkworkshop.com • https://docs.aws.amazon.com/cdk/api/latest/ • https://github.com/eladb/awesome-cdk • Engage with the community • https://github.com/awslabs/aws-cdk • https://gitter.im/awslabs/aws-cdk
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T
  • 19. Thank you! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C TO R S U M M I T Ryan Malecky rmalecky@amazon.com