SlideShare a Scribd company logo
1 of 39
Download to read offline
Can they really do that???
October 27, 2020
CFN, SAM and CDK tips and tricks
© 2020 EPAM Systems, Inc.
Agenda
1 C L O U D F O R M A T I O N
2
3
S A M
C D K
2
4 Q & A
© 2020 EPAM Systems, Inc.
CLOUDFORMATION
3
© 2020 EPAM Systems, Inc.
CFN SERVICE ROLES
4
© 2020 EPAM Systems, Inc.
1. CloudFormation Service Roles
5
• Using your own credentials for Stack operations is insecure
• Service roles allow CloudFormation to only have certain privileges to manage resources
• Roles are assigned to the stack.
• Keep the service roles secure!
© 2020 EPAM Systems, Inc.
CFN STACK POLICY
6
© 2020 EPAM Systems, Inc.
2. CloudFormation Stack Policy
7
• Is similar to Service Role, but affects only resources created with the stack
• Is mutable
• Use Logical Ids as “Resource” field.
© 2020 EPAM Systems, Inc.
2. CloudFormation Stack Policy examples
8
© 2020 EPAM Systems, Inc.
CFN CONDITIONS
9
© 2020 EPAM Systems, Inc.
3. CloudFormation Conditions
10
• Make templates universal defining if resources are needed or not
• Or a certain resource property is different depending on a condition
© 2020 EPAM Systems, Inc.
CFN AWS-SPECIFIC
PARAMETERS
11
© 2020 EPAM Systems, Inc.
4. CloudFormation AWS-Specific parameters
12
• Not just a String, but SubnetId, AMI,
KeyPair Name, etc.
• Additional validation, checking if the
resource supplied in parameter exists.
© 2020 EPAM Systems, Inc.
CFN STACKSETS IN
ORGANIZATIONS
13
© 2020 EPAM Systems, Inc.
5. CloudFormation StackSets in Organizations
14
• You can deploy Stack Instances not to just a list of accounts, but whole Org. Unit
• Handy when you have projects as OUs and environments as separate accounts in OU
• Or you need to centrally manage all the Accounts in the Organization
© 2020 EPAM Systems, Inc.
5. CloudFormation StackSets in Organizations
15
© 2020 EPAM Systems, Inc.
CFN HELPER SCRIPTS
16
© 2020 EPAM Systems, Inc.
6. CloudFormation Helper scripts
17
You can use helper scripts to:
• Manage your EC2 resources from the template declaration
• Use daemons for continuous updates
• Let CloudFormation know that configuration is finished (or failed)
Helper scripts don’t need IAM permissions (to talk to CloudFormation)!
© 2020 EPAM Systems, Inc.
6. CloudFormation Helper scripts
18
© 2020 EPAM Systems, Inc.
CFN INCLUDE MACRO
19
© 2020 EPAM Systems, Inc.
7. CloudFormation Include Macro
20
• Use it for the boilerplate code!
• Include template must be stored on S3
• It is possible to pass template parameters to the included template
• It is possible to use the returned values from the included template
• If you do something wrong, you will get validation error
© 2020 EPAM Systems, Inc.
7. CloudFormation Include Macro
21
© 2020 EPAM Systems, Inc.
CFN DISABLE ROLLBACK
22
© 2020 EPAM Systems, Inc.
8. CloudFormation Disable Rollback
23
• We all love CFN’s self-healing ability
• But sometimes we want to ignore it for the sake of performance
• Helpful when you develop and debug the template
• With Rollbacks disable the stack will remain in ”CREATE_FAILED” state until it receives
another stack operation
© 2020 EPAM Systems, Inc.
8. CloudFormation Disable Rollback
24
© 2020 EPAM Systems, Inc.
SAM
25
© 2020 EPAM Systems, Inc.
SAM GLOBALS
26
© 2020 EPAM Systems, Inc.
9. SAM Globals
27
• Define one property for all resources in the
template
• Can still be overridden
© 2020 EPAM Systems, Inc.
SAM WITH CFN
RESOURCE TYPES
28
© 2020 EPAM Systems, Inc.
10. SAM template with CloudFormation resource types
29
© 2020 EPAM Systems, Inc.
CDK
30
© 2020 EPAM Systems, Inc.
CDK ASSETS
31
© 2020 EPAM Systems, Inc.
11. CDK Assets
32
• Bundle your source code in your infrastructure code!
• Docker containers for ECS, deployment packages for Lambda
© 2020 EPAM Systems, Inc.
CDK MULTI-STACK
33
© 2020 EPAM Systems, Inc.
12. CDK Multi-Stack
34
© 2020 EPAM Systems, Inc.
CDK TESTING
35
© 2020 EPAM Systems, Inc.
13. CDK Testing
36
© 2020 EPAM Systems, Inc.
13. CDK Testing
37
© 2020 EPAM Systems, Inc.
THANK YOU!
38
© 2020 EPAM Systems, Inc.
Q&A?
39

More Related Content

Similar to Can they really do that: CloudFormation, SAM and CDK tips'n'tricks

What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?DevOps.com
 
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...Amazon Web Services
 
Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...
Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...
Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...Amazon Web Services
 
DevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical IntroductionDevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical Introductionaledsage
 
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...IBM Systems UKI
 
Oracle Enterprise Manager Seven Robust Features to Put in Action final
Oracle Enterprise Manager Seven Robust Features to Put in Action finalOracle Enterprise Manager Seven Robust Features to Put in Action final
Oracle Enterprise Manager Seven Robust Features to Put in Action finalDatavail
 
Creating a RDS MySQL instance from AWS Console and CloudFormation
Creating a RDS MySQL instance from AWS Console and CloudFormationCreating a RDS MySQL instance from AWS Console and CloudFormation
Creating a RDS MySQL instance from AWS Console and CloudFormationSubhamay Bhattacharyya
 
Pivotal Platform - December Release A First Look
Pivotal Platform - December Release A First LookPivotal Platform - December Release A First Look
Pivotal Platform - December Release A First LookVMware Tanzu
 
利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統Amazon Web Services
 
Twelve-Factor serverless applications - MAD307 - New York AWS Summit
Twelve-Factor serverless applications - MAD307 - New York AWS SummitTwelve-Factor serverless applications - MAD307 - New York AWS Summit
Twelve-Factor serverless applications - MAD307 - New York AWS SummitAmazon Web Services
 
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...Amazon Web Services
 
Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...Amazon Web Services
 
DRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELM
DRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELMDRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELM
DRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELMDrupalCamp Kyiv
 
Lets saasify that desktop application
Lets saasify that desktop applicationLets saasify that desktop application
Lets saasify that desktop applicationChirag Jog
 
Modern-Application-Design-with-Amazon-ECS
Modern-Application-Design-with-Amazon-ECSModern-Application-Design-with-Amazon-ECS
Modern-Application-Design-with-Amazon-ECSAmazon Web Services
 
Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...
Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...
Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...Amazon Web Services
 
Breaking the Monolith road to containers.pdf
Breaking the Monolith road to containers.pdfBreaking the Monolith road to containers.pdf
Breaking the Monolith road to containers.pdfAmazon Web Services
 
Operationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software LifecycleOperationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software LifecycleAmazon Web Services
 

Similar to Can they really do that: CloudFormation, SAM and CDK tips'n'tricks (20)

What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?
 
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
 
Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...
Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...
Earn Your DevOps Black Belt: Deployment Scenarios with AWS CloudFormation (DE...
 
DevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical IntroductionDevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical Introduction
 
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
Pure Systems Patterns of Expertise - John Kaemmerer and Gerry Kovan, 11th Sep...
 
Oracle Enterprise Manager Seven Robust Features to Put in Action final
Oracle Enterprise Manager Seven Robust Features to Put in Action finalOracle Enterprise Manager Seven Robust Features to Put in Action final
Oracle Enterprise Manager Seven Robust Features to Put in Action final
 
Creating a RDS MySQL instance from AWS Console and CloudFormation
Creating a RDS MySQL instance from AWS Console and CloudFormationCreating a RDS MySQL instance from AWS Console and CloudFormation
Creating a RDS MySQL instance from AWS Console and CloudFormation
 
Pivotal Platform - December Release A First Look
Pivotal Platform - December Release A First LookPivotal Platform - December Release A First Look
Pivotal Platform - December Release A First Look
 
Deep Dive on AWS CloudFormation
Deep Dive on AWS CloudFormationDeep Dive on AWS CloudFormation
Deep Dive on AWS CloudFormation
 
利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統
 
Twelve-Factor serverless applications - MAD307 - New York AWS Summit
Twelve-Factor serverless applications - MAD307 - New York AWS SummitTwelve-Factor serverless applications - MAD307 - New York AWS Summit
Twelve-Factor serverless applications - MAD307 - New York AWS Summit
 
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
 
CI/CD using AWS developer tools
CI/CD using AWS developer toolsCI/CD using AWS developer tools
CI/CD using AWS developer tools
 
Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...
 
DRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELM
DRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELMDRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELM
DRUPAL CI/CD FROM DEV TO PROD WITH GITLAB, KUBERNETES AND HELM
 
Lets saasify that desktop application
Lets saasify that desktop applicationLets saasify that desktop application
Lets saasify that desktop application
 
Modern-Application-Design-with-Amazon-ECS
Modern-Application-Design-with-Amazon-ECSModern-Application-Design-with-Amazon-ECS
Modern-Application-Design-with-Amazon-ECS
 
Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...
Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...
Building PaaS with Amazon EKS for the Large-Scale, Highly Regulated Enterpris...
 
Breaking the Monolith road to containers.pdf
Breaking the Monolith road to containers.pdfBreaking the Monolith road to containers.pdf
Breaking the Monolith road to containers.pdf
 
Operationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software LifecycleOperationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
 

Recently uploaded

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Recently uploaded (20)

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Can they really do that: CloudFormation, SAM and CDK tips'n'tricks

  • 1. Can they really do that??? October 27, 2020 CFN, SAM and CDK tips and tricks
  • 2. © 2020 EPAM Systems, Inc. Agenda 1 C L O U D F O R M A T I O N 2 3 S A M C D K 2 4 Q & A
  • 3. © 2020 EPAM Systems, Inc. CLOUDFORMATION 3
  • 4. © 2020 EPAM Systems, Inc. CFN SERVICE ROLES 4
  • 5. © 2020 EPAM Systems, Inc. 1. CloudFormation Service Roles 5 • Using your own credentials for Stack operations is insecure • Service roles allow CloudFormation to only have certain privileges to manage resources • Roles are assigned to the stack. • Keep the service roles secure!
  • 6. © 2020 EPAM Systems, Inc. CFN STACK POLICY 6
  • 7. © 2020 EPAM Systems, Inc. 2. CloudFormation Stack Policy 7 • Is similar to Service Role, but affects only resources created with the stack • Is mutable • Use Logical Ids as “Resource” field.
  • 8. © 2020 EPAM Systems, Inc. 2. CloudFormation Stack Policy examples 8
  • 9. © 2020 EPAM Systems, Inc. CFN CONDITIONS 9
  • 10. © 2020 EPAM Systems, Inc. 3. CloudFormation Conditions 10 • Make templates universal defining if resources are needed or not • Or a certain resource property is different depending on a condition
  • 11. © 2020 EPAM Systems, Inc. CFN AWS-SPECIFIC PARAMETERS 11
  • 12. © 2020 EPAM Systems, Inc. 4. CloudFormation AWS-Specific parameters 12 • Not just a String, but SubnetId, AMI, KeyPair Name, etc. • Additional validation, checking if the resource supplied in parameter exists.
  • 13. © 2020 EPAM Systems, Inc. CFN STACKSETS IN ORGANIZATIONS 13
  • 14. © 2020 EPAM Systems, Inc. 5. CloudFormation StackSets in Organizations 14 • You can deploy Stack Instances not to just a list of accounts, but whole Org. Unit • Handy when you have projects as OUs and environments as separate accounts in OU • Or you need to centrally manage all the Accounts in the Organization
  • 15. © 2020 EPAM Systems, Inc. 5. CloudFormation StackSets in Organizations 15
  • 16. © 2020 EPAM Systems, Inc. CFN HELPER SCRIPTS 16
  • 17. © 2020 EPAM Systems, Inc. 6. CloudFormation Helper scripts 17 You can use helper scripts to: • Manage your EC2 resources from the template declaration • Use daemons for continuous updates • Let CloudFormation know that configuration is finished (or failed) Helper scripts don’t need IAM permissions (to talk to CloudFormation)!
  • 18. © 2020 EPAM Systems, Inc. 6. CloudFormation Helper scripts 18
  • 19. © 2020 EPAM Systems, Inc. CFN INCLUDE MACRO 19
  • 20. © 2020 EPAM Systems, Inc. 7. CloudFormation Include Macro 20 • Use it for the boilerplate code! • Include template must be stored on S3 • It is possible to pass template parameters to the included template • It is possible to use the returned values from the included template • If you do something wrong, you will get validation error
  • 21. © 2020 EPAM Systems, Inc. 7. CloudFormation Include Macro 21
  • 22. © 2020 EPAM Systems, Inc. CFN DISABLE ROLLBACK 22
  • 23. © 2020 EPAM Systems, Inc. 8. CloudFormation Disable Rollback 23 • We all love CFN’s self-healing ability • But sometimes we want to ignore it for the sake of performance • Helpful when you develop and debug the template • With Rollbacks disable the stack will remain in ”CREATE_FAILED” state until it receives another stack operation
  • 24. © 2020 EPAM Systems, Inc. 8. CloudFormation Disable Rollback 24
  • 25. © 2020 EPAM Systems, Inc. SAM 25
  • 26. © 2020 EPAM Systems, Inc. SAM GLOBALS 26
  • 27. © 2020 EPAM Systems, Inc. 9. SAM Globals 27 • Define one property for all resources in the template • Can still be overridden
  • 28. © 2020 EPAM Systems, Inc. SAM WITH CFN RESOURCE TYPES 28
  • 29. © 2020 EPAM Systems, Inc. 10. SAM template with CloudFormation resource types 29
  • 30. © 2020 EPAM Systems, Inc. CDK 30
  • 31. © 2020 EPAM Systems, Inc. CDK ASSETS 31
  • 32. © 2020 EPAM Systems, Inc. 11. CDK Assets 32 • Bundle your source code in your infrastructure code! • Docker containers for ECS, deployment packages for Lambda
  • 33. © 2020 EPAM Systems, Inc. CDK MULTI-STACK 33
  • 34. © 2020 EPAM Systems, Inc. 12. CDK Multi-Stack 34
  • 35. © 2020 EPAM Systems, Inc. CDK TESTING 35
  • 36. © 2020 EPAM Systems, Inc. 13. CDK Testing 36
  • 37. © 2020 EPAM Systems, Inc. 13. CDK Testing 37
  • 38. © 2020 EPAM Systems, Inc. THANK YOU! 38
  • 39. © 2020 EPAM Systems, Inc. Q&A? 39