CloudFormationandOpsWork
CloudFormationandOpsWork
An AWS service that uses template files to automate the setup of AWS
resources.
• Easy to automate
• Reproducible
• Not human readable
• Too many parameters
Cloud Formation
Templated Provision
• Provision identical copies of a stack structure
Cloud Formation : Infrastructure As a code
• Write or create your template right from the start, or you can also use one of
the example templates pre-offered by AWS.
• Along with that, the users are allowed to use several AWS products within
CloudFormation, such as Amazon Elastic Beanstalk, Amazon RDS, and
Amazon EC2.
• The CloudFormation template will elaborate on the resources you want and
the settings associated with them.
• For instance, if you wish to create one EC2 instance, then your template will
declare the same and describe the properties.
• Once you have created the template, save it either in the S3 bucket or locally.
Make sure you save it with an extension such as .txt, .yaml, or .json.
• Validate templates
• Use Parameter types
• Use Mappings
• Use Deletion Policies
• Use IAM and tags
Cloud Formation: Validate Templates
• JSON/YAML syntax
• Absence of circular dependencies
• Template Structure
Cloud Formation: Parameters
Cloud Formation: Parameter Constraints
Cloud Formation: Mappings
Cloud Formation: Using Template via AWS CLI
Supported AWS Services
Reference Function in Template
Literal References in Template
Mapping in Template
AWS OpsWorks
What is AWS OpsWorks?
• HAProxy
• Ruby
• Node.js
• Java
• PHP
• Static Web
• Ganglia
• Memcached
• MySQL
• Custom
Major Concepts: Applications
• Applications are your code, sourced from a git or subversion repository, an
S3 bucket, or even an external web site.
• Scalable Infrastructure
• Flexible
• Deploy often
• Staging environments
Improve Reliability
Improve Control
• Versioned config
• Control anything you can script with Chef recipes
• Lock down console access
• Change and deployment logs
Scaling
• 24/7 hours instances added to a layer can manually start, stop or reboot the
corresponding EC2 instances.
• Automatic Scaling
Time based instances based on a schedule
Load based instances based on several load metric (Network Metric,
CPU Utilization)
• Combination of all 3 types is an effective strategy.
Deployment and Customization
• Whenever a change happens on your stack or upon request, all instances are
notified and recipes are run.
AWS OpsWorks Agent : Custom Recipes
AWS OpsWorks Agent : Custom Recipes
AWS OpsWorks Agent : Life Cycle Events
• Set up
This event occurs after a started instance has finished booting.
• Configure
This event occurs on all of the stack's instances when one of the following
occurs:
1. An instance enters or leaves the online state.
2. You associate an Elastic IP address with an instance or disassociate one
from an instance.
3. You attach an Elastic Load Balancing load balancer to a layer, or detach one
from a layer.
AWS OpsWorks Agent : Life Cycle Events
Deploy
• This event occurs when you run a Deploy command, typically to deploy an
application to a set of application server instances.
• The instances run recipes that deploy the application and any related files
from its repository to the layer's instances.
Undeploy
• This event occurs when you delete an app or run an Undeploy command to
remove an app from a set of application server instances.
• The specified instances run recipes to remove all application versions and
perform any required cleanup.
Shutdown
• The event occurs after you direct AWS OpsWorks Stacks to shut an instance
down but before the associated Amazon EC2 instance is actually terminated.
AWS OpsWorks for Chef Automate
• Fully managed chef server
• Programmable Infrastructure
• Automatic Backups