Aws dev ops 4 cs part 2 configuration management
-
Upload
flux7-award-winning-it-consultancy-focused-on-cloud-containers-cicd-and-configuration-managemen -
Category
Technology
-
view
490 -
download
1
Transcript of Aws dev ops 4 cs part 2 configuration management
![Page 1: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/1.jpg)
Date:
Presenter:
AWS Meetup: DevOps
5/26/2016
Aater Suleman
![Page 2: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/2.jpg)
Achievements
About Flux7
Aater Suleman Co-Founder & CEO Flux7 Faculty, University of Texas at Austin
Flux7: Cloud and DevOps SolutionsFounded in 2013Team of 35+Headquartered in Austin, Texas
AWS DevOps, Healthcare, and Life Sciences Competencies
TechTarget’s “Impact Best AWS Consulting Partner” two years in a row (2015 & 2016)
Partner Recognition Award by AWS at reInvent 2015
Customers featured on stage at AWS re:Invent three years in a row
Docker Foundation and authorized consulting partner
150+ happy customers through word of mouth
“[Flux7] taught us how to do 10x the work in 1/10th the
time” - Patrick K, AWS Re:invent’14,
CTO’s Keynote
![Page 3: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/3.jpg)
★ Frontend HTML/JS developers★ Backend developers★ Operations folks ★ Business: Managers/executives
Quick Poll
HOW MANY?
★ Enterprise ( > 1B in cap )★ Mid-tier ★ SMBs
HOW MANY?
![Page 4: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/4.jpg)
POP
Purpose: To provide the audience working knowledge and a sample DevOps workflow implemented on AWS
Outcomes:
- The audience shall be able to:- The role of 4Cs in DevOps - A sample use of each C and how everything ties together
- Take home a working DevOps environment
![Page 5: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/5.jpg)
POP (Continued)
Cloud Config Management CI/CD
Automated Infrastructure Provisioning
Automated software
provisioning
Using the automation to build continuous delivery
Containers
Building DevOps using containers
Plan:
![Page 6: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/6.jpg)
DevOps
![Page 7: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/7.jpg)
DevOps
![Page 8: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/8.jpg)
Delivering technology includes the delivery of:
Delivery of Technology
CodeInfrastructure Server Configurations
![Page 9: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/9.jpg)
Delivering technology includes the delivery of:
Delivery of Technology
CodeInfrastructure Server Configurations
![Page 10: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/10.jpg)
AWS DevOps 4 Cs - Part 2Configuration Management
![Page 11: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/11.jpg)
A laptop with web browser, a text editor,
and Wifi
Pre-reqs
AWS account with PowerUser privileges
Basic understanding of CloudFormation for
provisioning EC2 instances
![Page 12: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/12.jpg)
You will be able to:
Understand where CloudFormation::Init fits in the picture
Read and modify CloudFormation::Init code
Deploy and Debug an application stack with CF::Init
Test stack with a Hello World application
Outcomes
![Page 13: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/13.jpg)
Agenda
Present
➔ Provide a big picture view
➔ Concepts
➔ Walkthrough sample code
Hands On
➔ Deploy a Stack
➔ Extend the deployment
![Page 14: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/14.jpg)
What is Configuration Management?
Name Examples
App App, Assets, App config
ConfigPrerequisite software for app (IIS, Apache,
Monitoring agents, etc)
OS AWS-provided
Infrastructure (Networking, VMs)
Last meetup: Slides and notes in Github
![Page 15: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/15.jpg)
A mechanism to provision software on an EC2 instance
Typically used in conjunction with CloudFormation at the time of instance creation
Provides hooks for typical configuration tasks: install packages, download archive files, and create users, groups, files, folders.
Capable of running arbitrary shell commands or scripts
Leads to immutable infrastructure and configuration fully specified in a single file
CF::Init
![Page 16: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/16.jpg)
Where does it fit in?
Name Examples
App App, Assets, App config
ConfigPrerequisite software for app (IIS, Apache,
Monitoring agents, etc)
OS AWS-provided
AMI
Infrastructure (Networking, VMs)
cf::init
![Page 17: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/17.jpg)
CF::Init
Requires an agent
Uses resources in the CloudFormation stack itself as configuration DB
A part of AWS CloudFormation
Allows for provisioning and maintenance
CF::Init vs. Chef/Puppet
Chef/Puppet
Requires an agent
Uses a centralized server/service as configuration DB
3rd party independent tool
Allows for provisioning and maintenance
![Page 18: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/18.jpg)
CF::Init
Designed for “cattle” but can be used with “pets” with effort
Focus on provisioning
Tight integration with infrastructure provisioning
Auto-scaling and spot-instance friendly
CF::Init vs. Chef/Puppet
Chef/Puppet
Designed for “pets” but can be used with “cattle” with effort
Focus on management
Richer and more programmable
Larger ecosystems
Can be used outside of AWS
![Page 19: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/19.jpg)
OpsWorks:
Chef-based solution for configuration management
Other solutions from AWS
ElasticBeanstalk:
Pre-built AMIs (aka. VM images) for common platforms like
node.js, Django, IIS, etc
![Page 20: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/20.jpg)
CF::Init
![Page 21: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/21.jpg)
CloudFormation::Init
✓ Mechanism for configuring an EC2 instance at launch (or later)
✓ Describe the configuration with a JSON descriptor
"AWS::CloudFormation::Init" : { "configSets" : { "set1" : [ "1" ] }, "1" : { "commands" : { "test" : { "command" : "echo \"$CFNTEST\" > test.txt", "env" : { "CFNTEST" : "I come from config1." }, "cwd" : "~" } } }}
![Page 22: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/22.jpg)
Terms
Metadata: Specified structured data with
a CF resource
User data: A mechanism to specify a “boot”
script in EC2
cfn-init:
Agent to install software and to start services
![Page 23: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/23.jpg)
More Terms
Config: A collection of steps specifying
what to do on an instance
configSet: A set of configs to run on the
instance
Resource: The EC2 instance being
configured
![Page 24: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/24.jpg)
How it works?
Metadata from CloudFormation cfn-init
userdata
3
4 5Configure instance
Create CloudFormation Stack
EC2 instance launch
1
2
1. User triggers creation of a CF Stack which triggers an EC2 launch
2. Once launched, cloud-init agent on the instance runs a script specified in user data
3. User data script installs and runs cfn-init
4. Cfn-init downloads metadata for resource from CF
5. Cfn-init runs config sets
![Page 25: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/25.jpg)
How it is specified
"MyInstance": { "Type": "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : {
} }, "Properties": { } }
MetaData
UserData
![Page 26: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/26.jpg)
UserData
"MyInstance": { "Type": "AWS::EC2::Instance", "Metadata" : { }, "Properties": { :
} }
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [ "#!/bin/bash -xe\n", "yum update -y aws-cfn-bootstrap\n",
"# Install the files and packages from the metadata\n", "/opt/aws/bin/cfn-init -v ", " --stack ", { "Ref" : "AWS::StackName" }, " --resource WebServerInstance ", " --configsets Install ", " --region ", { "Ref" : "AWS::Region" }, "\n"
]]}} }
Resource: The name of the EC2 resource which has the metadata
configsets: Which configsets specified in the meta data to run (more to come)
![Page 27: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/27.jpg)
MetaData
"MyInstance": { "Type": "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : {
} }, "Properties": { } }
"AWS::CloudFormation::Init" : { "configSets" : { "ascending" : [ "config1" , "config2" ], "descending" : [ "config2" , "config1" ] }, "config1" : {
Config Attributes }, "config2" : {
Config Attributes }}
![Page 28: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/28.jpg)
Configs
commands:
Commands to run
packages:
Packages to install
users:
Users to create
& a few more
![Page 29: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/29.jpg)
How it is specified?"AWS::CloudFormation::Init" : { "configSets" : { "ascending" : [ "config1" , "config2" ], "descending" : [ "config2" , "config1" ] }, "config1" : {
Config Attributes }, "config2" : {
Config Attributes }}
"commands" : { "test" : { "command" : "echo \"$MAGIC\" > test.txt", "env" : { "MAGIC" : "An env" }, "cwd" : "~", "test" : "test ! -e ~/test.txt", "ignoreErrors" : "false" }},"packages" : { "yum" : { "httpd" : [], "php" : [], "wordpress" : [] }},"users" : { "myUser" : { "groups" : ["groupOne", "groupTwo"], "uid" : "50", "homeDir" : "/tmp" }}
![Page 30: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/30.jpg)
Anything else?
➔ Sources: Download and unpack an archive like tar, zip, tar.gz, etc
➔ Groups: Create Unix/Linux groups and assign Ids
➔ Files: To create a new file with inline content or from a URL
➔ Services: To start services on Linux or Windows
![Page 31: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/31.jpg)
Resources
Starter Code:
https://github.com/Flux7Labs/aws-devops-tutorial
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/updating.stacks.walkthrough.html
![Page 32: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/32.jpg)
Thank You
![Page 33: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/33.jpg)
How do I:
❓ Write a template ◎ Text editor (VS, Eclipse)
❓ Catch syntactic errors◎ CF validate
❓ Catch logical errors◎ ChangeSets
❓ Provision◎ Create stack
❓ Access outputs◎ Review the console
❓ Update an existing stack◎ Update stack
❓ Debug errors◎ Review error logs
![Page 34: Aws dev ops 4 cs part 2 configuration management](https://reader031.fdocuments.us/reader031/viewer/2022021922/586f887f1a28ab54768b5cab/html5/thumbnails/34.jpg)
CF::Init
Runs when VM is created
Can run arbitrary code
Best for installing immutable components often universal across applications and change with “infrastructure,” e.g., Anti-Virus, Monitoring agent, etc.
CF::Init vs. CodeDeploy
CodeDeploy
Runs after VM is running, including scale up events
Can run arbitrary code
Best for installing components that are application specific and change between application deploys, e.g., Application code, config files, Apache modules, etc