2. Agenda
• Infrastructure as Code
• What is AWS CloudFormation?
• Our Use Case
• JSON & YAML
• Template Anatomy
• CFN Actions
• Learn by Example
• Other Topics and Features
• CloudFormation vs Terraform
3. Infrastructure as Code (IaaC)
• A process of managing and provisioning data centers through
machine readable definition files.
• IaaC grew as a response to the difficulty posed from two pieces
of technology – utility computing (AWS EC2) and second-
generation web frameworks (1st Version of Ruby on Rails).
• IaaC ≠ IaaS
• Reduced Cost, Faster Execution, Less Errors
• Approaches: Declarative (Functional), Imperative (Procedural),
Intelligent (Env. Aware)
• Methods: Push and Pull
4. • AWS CloudFormation is a service that helps you model and set up your Amazon Web
Services resources so that you can spend less time managing those resources and
more time focusing on your applications that run in AWS.
• Initial Release 25th Feb 2011
What is AWS CloudFormation (CFN)?
5. • A LAMP Stack is a set of open-source software
that can be used to create websites and web
applications. LAMP is an acronym, and these
stacks typically consist of the Linux operating
system, the Apache HTTP Server, the MySQL
relational database management system, and
the PHP programming language.
Linux
Operating System Layer
Apache
Web Server Layer
MySQL
Database Layer
PHP/Perl/Python
Scripting Layer
WordPress
Web Application
LAMPStack
Use Case: WordPress Instance
6. • JavaScript Object Notation
• A syntax for storing and exchanging data.
• Lightweight, self-describing and easy to understand.
• Consists of “Name : Value” pairs separated by “,”
enclosed between “{}”.
• Names are unique inside the object.
• Names and Strings are wrapped by double quotes.
JSON
8. • YAML Ain’t Markup Language
• A syntax for storing and exchanging data.
• Human friendly, self-describing and easy to understand.
• A superset of JSON.
• Consists of “Name : Value” pairs separated by “New
Lines”.
• Allows in-line comments – begin with ‘#’ -> EOL
• Indentation (white spaces) controls the structure.
• Avoid using Tabs.
YAML
16. • What will happen if we created
another stack in the same or any
other region with the same
template?
• Stack will succeed
• Stack will fail
• Stack will partially succeed
WP-Demo-01: Question 1
17. • What will happen if we created
another stack in the same or any
other region with the same
template?
• Stack will succeed
• Stack will fail
• Stack will partially succeed
Bucket name is unique
across all regions
WP-Demo-01: Question 1
18. • What will happen if we deleted
this stack and created another
stack in another region with the
same template?
• Stack will succeed
• Stack will fail
• Stack will partially succeed
WP-Demo-01: Question 2
19. • What will happen if we deleted
this stack and created another
stack in another region with the
same template?
• Stack will succeed
• Stack will fail
• Stack will partially succeed
AMI Id is different
across regions
WP-Demo-01: Question 2
20. • Not reusable – hard coded S3
bucket name
• Not portable – hard coded AMI Id
• Not reusable – hard coded
instance size for EC2 and DB
WP-Demo-01 Template Issues
21. • Not reusable – hard coded S3
bucket name
• Not portable – hard coded AMI Id
• Not reusable – hard coded
instance size for EC2 and DB
• Solution:
• Dynamic S3 Bucket Name
WP-Demo-01 Template Solutions
22. • Not reusable – hard coded S3
bucket name
• Not portable – hard coded AMI Id
• Not reusable – hard coded
instance size for EC2 and DB
• Solution:
• Dynamic S3 Bucket Name
• Dynamic Mapping + Pseudo
Parameters + Intrinsic Functions
WP-Demo-01 Template Solutions
23. • Not reusable – hard coded S3
bucket name
• Not portable – hard coded AMI Id
• Not reusable – hard coded
instance size for EC2 and DB
• Solution:
• Dynamic S3 Bucket Name
• Dynamic Mapping + Pseudo
Parameters + Intrinsic Functions
• Dynamic Mapping + Parameters +
Pseudo Parameters + Intrinsic
Functions
WP-Demo-01 Template Solutions
24. • Reusability in same region
• Portability to different regions
• Stack Update and Change Set
WP-Demo-02: Reusability and Portability
25. • Install PHP
• Install MySQL
• Install Apache
• Install WordPress & Configure
• Update System
User Data
You can safely remove this slide. This slide design was provided by SlideModel.com – You can download more templates, shapes and elements for PowerPoint from http://slidemodel.com
You can safely remove this slide. This slide design was provided by SlideModel.com – You can download more templates, shapes and elements for PowerPoint from http://slidemodel.com