AWS CloudFormation: Infrastructure as Code | AWS Public Sector Summit 2016
Infrastructure as Code with AWS CloudFormation
-
Upload
justyna-janczyszyn -
Category
Technology
-
view
296 -
download
2
Transcript of Infrastructure as Code with AWS CloudFormation
![Page 1: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/1.jpg)
Infrastructure as code with
AWS CloudFormation
PyMunich 2016
![Page 2: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/2.jpg)
Justyna Janczyszyn (JJ)
@JJanczyszyn
software engineer at 10Clouds
![Page 3: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/3.jpg)
![Page 4: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/4.jpg)
CHALLENGES
4 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 5: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/5.jpg)
5 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 6: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/6.jpg)
6 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 7: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/7.jpg)
7 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 8: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/8.jpg)
8 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 9: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/9.jpg)
9 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Image taken from: Infrastructure as Code by Kief Morris
![Page 10: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/10.jpg)
10 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 11: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/11.jpg)
11 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 12: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/12.jpg)
Infrastructure as code principles and practices to the rescue!
12 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 13: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/13.jpg)
Any element of infrastructure should be easily reproducible
13 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Infrastructure as Code by Kief Morris
![Page 14: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/14.jpg)
Systems should be consistent
14 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Infrastructure as Code by Kief Morris
![Page 15: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/15.jpg)
Processes should be repeatable
15 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Infrastructure as Code by Kief Morris
![Page 16: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/16.jpg)
Design is always changing
16 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Infrastructure as Code by Kief Morris
![Page 17: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/17.jpg)
Practices
17 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
• Use Definition files • Self-documented systems and processes • Version all the things • Continuously test the systems and processes • Small changes rather than batches • Services available continuously
Infrastructure as Code by Kief Morris
![Page 18: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/18.jpg)
CloudFormation
18 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 19: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/19.jpg)
19 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 20: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/20.jpg)
20 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Image taken from http://fbrnc.net/blog/2016/05/green-blue-deployments-with-aws-lambda-and-cloudformation
![Page 21: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/21.jpg)
Creating a stack
21 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
aws cloudformation create-stack --stack-name demo-iac
--template-body file://Template.yaml --parameters file://Params.json
--capabilities CAPABILITY_NAMED_IAM --region eu-west-1;
![Page 22: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/22.jpg)
![Page 23: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/23.jpg)
23 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 24: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/24.jpg)
24 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 25: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/25.jpg)
25 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 26: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/26.jpg)
26 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
aws cloudformation describe-stacks --stack-name demo-iac
Describe a stack
![Page 27: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/27.jpg)
![Page 28: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/28.jpg)
Delete a stack
28 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
aws cloudformation delete-stack —stack-name demo-iac
![Page 29: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/29.jpg)
Change Sets
29 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
https://aws.amazon.com/blogs/aws/new-change-sets-for-aws-cloudformation/
![Page 30: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/30.jpg)
https://aws.amazon.com/blogs/aws/new-change-sets-for-aws-cloudformation/
![Page 31: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/31.jpg)
aws cloudformation estimate-template-cost --template-body file://Template.yaml
--parameters file://Params.json;
31 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Cost estimation
![Page 32: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/32.jpg)
32 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
![Page 33: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/33.jpg)
33 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Best Practices
![Page 34: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/34.jpg)
34 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Planning and organizing
• organize stacks by lifecycle and ownership • reuse templetes for various environments • use nested stacks
![Page 35: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/35.jpg)
35 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Creating templates• don’t embed credentials in templates • validate templates before using them • use parameter constraints
![Page 36: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/36.jpg)
36 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
Managing stacks
• use stack policies • use change sets • manage all stack resources through cloudformation • use code reviews and revision for your templates
![Page 37: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/37.jpg)
Ready to use templates
37 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
• https://github.com/awslabs/aws-cloudformation-templates
• https://github.com/widdix/aws-cf-templates
![Page 38: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/38.jpg)
Library to create AWS CloudFormation descriptions
38 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
• https://github.com/cloudtools/troposphere
![Page 39: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/39.jpg)
Other resources
39 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code
• Infrastructure as Code by Kief Morris
http://infrastructure-as-code.com/
• Martin Fowler’s Infrastructure as Code at YOW! 2016:
https://www.youtube.com/watch?v=ueAef9tNUck
http://martinfowler.com/bliki/InfrastructureAsCode.html
• Great blog on AWS:
https://cloudonaut.io/
![Page 40: Infrastructure as Code with AWS CloudFormation](https://reader031.fdocuments.in/reader031/viewer/2022021502/58f2a8dc1a28ab7d788b4591/html5/thumbnails/40.jpg)
Step by step automate all
40 PyMunich 2016@JJanczyszyn
https://github.com/tramwaj29/infrastructure-as-code