Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Automating Infrastructures with AWS Cloud Forma...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Jeremy Przygode
May 02, 2013
Technology
4.9k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Automating Infrastructures with AWS Cloud Formation and Chef
Automating Infrastructures with AWS Cloud Formation and Chef
Jeremy Przygode
May 02, 2013
Other Decks in Technology
See All in Technology
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
770
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
"優秀な誰か"の下位互換にならないために
yut0naga1_fa
1
1.8k
Refining Active Record
shugo
0
160
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
530
⾮構造化データを価値に変える AI エージェント基盤とその組織
ivry_presentationmaterials
0
190
Running Kotlin + Quarkus with Lambda
nealle
1
3.7k
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
0
200
S3 Filesで挑む! 八戸せんべい汁の食べ頃問題
usanchuu
0
100
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
870
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
340
Local CI × GitHub Actions
gogutan
2
200
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
What's in a price? How to price your products and services
michaelherold
247
13k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Fireside Chat
paigeccino
43
4.1k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
Navigating Team Friction
lara
192
16k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
The Cost Of JavaScript in 2023
addyosmani
55
10k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Transcript
None
Stratalux is an AWS Managed Services Provider We build highly
scalable websites in the cloud 2
A match made in the Hall of Justice. 3
Infrastructure as code ™ 4
Consistent builds and configurations 5
Backups! 6
Things break! 7
Reduced costs! 8
Flexibility! 9
10
11
• Create Chef roles and cookbooks • Build pre-loaded AMIs
• Create CFN template • Launch • Manage Change – Chef – CFN 12
• Why? – Preload Chef version – Preload dependencies •
Benefits – Improves launch speed – Reduces external dependencies – More Control 13 • How? – We use Chef to configure AMIs.
• Parameters • Mappings • Resources • Functions 14
15 "KeyName": { "Type": "String", "Description": "Name of an existing
EC2 KeyPair to enable SSH access to the web server", "Default": “stratalux-AWS-US-West2" }, "InstanceType": { "Description": "Application Server EC2 instance type", "Type": "String", "Default": "m1.small", "AllowedValues": ["t1.micro", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "c1.medium", "c1.xlarge", "cc1.4xlarge", "cc2.8xlarge", "cg1.4xlarge"], "ConstraintDescription": "must be a valid EC2 instance type." },
16 "ChefOrganization": { "Description": "The Organization name used in Hosted
Chef.", "Type": "String", "Default": “stratalux" }, "ChefEnvironment": { "Description": "The Chef Environment.", "Type": "String", "Default": “Production" }, "ChefRunList": { "Description": "The Chef runlist.", "Type": "String", "Default": "role[application_server]" },
17 "DomainName": { "Description": "Server Domain Name.", "Type": "String", "Default":
“strata.1ux.it" }, "ChefServerPrivateKeyBucket": { "Description": "S3 bucket containing validation private key for Chef Server", "Type": "String", "Default": "stlx.cfn" }
18 "Mappings" : { "RegionMap" : { "us-east-1" : {
"AMI" : "ami-76f0061f" }, "us-west-1" : { "AMI" : "ami-655a0a20" }, "eu-west-1" : { "AMI" : "ami-7fd4e10b" }, "ap-southeast-1" : { "AMI" : "ami-72621c20" } } }
• Resources 19 “AppServerAccess ": { "Type": "AWS::EC2::SecurityGroup", "Properties": {
"GroupDescription": “AppServerAccess", "SecurityGroupIngress": [ { "IpProtocol": "tcp", "FromPort": "8080", "ToPort": "8080", "CidrIp": "0.0.0.0/0"} ]}},
20 • Needed AWS Resources – IAM User & Access
Key – S3 Bucket Policy – Auto Scaling Group – Launch Configuration – Security Groups – Load Balancer – Scaling Policy – Cloudwatch Alarms – WaitConditions – SNS topic
“AppServerAccess ": { "Type": "AWS::EC2::SecurityGroup", "Properties": { "GroupDescription": “AppServerAccess", "SecurityGroupIngress":
[ { "IpProtocol": "tcp", "FromPort": "8080", "ToPort": "8080", "CidrIp": "0.0.0.0/0"} ]}}, 21
"AppServerGroup": { "Type": "AWS::AutoScaling::AutoScalingGroup", "Properties": { "AvailabilityZones": { "Fn::GetAZs": ""},
"LaunchConfigurationName": { "Ref": "ChefClient"}, "LoadBalancerNames": [ {"Ref": “appserverstratalux1uxit"} ], "MinSize": "2", "MaxSize": "10" }}, 22
"AppServerScaleUpPolicy": { "Type": "AWS::AutoScaling::ScalingPolicy", "Properties": { "AdjustmentType": "ChangeInCapacity", "AutoScalingGroupName": {
"Ref": "AppServerGroup" }, "Cooldown": "60", "ScalingAdjustment": "1"} }, 23
"AppServerScaleDownPolicy": { "Type": "AWS::AutoScaling::ScalingPolicy", "Properties": { "AdjustmentType": "ChangeInCapacity", "AutoScalingGroupName": {
"Ref": "AppServerGroup" }, "Cooldown": "60", "ScalingAdjustment": "-1"} }, 24
"CPUAlarmHigh": { "Type": "AWS::CloudWatch::Alarm", "Properties": { "AlarmDescription": "Scale-up if CPU
> 75% for 2 minutes", "MetricName": "CPUUtilization", "Namespace": "AWS/EC2", "Statistic": "Average", "Period": "60", "EvaluationPeriods": "2", "Threshold": "75", "AlarmActions": [{ "Ref": "AppServerScaleUpPolicy"}], "Dimensions": [{ "Name": "AutoScalingGroupName", "Value": { "Ref": "AppServerGroup"}}], "ComparisonOperator": "GreaterThanThreshold“ }}, 25
"CPUAlarmLow": { "Type": "AWS::CloudWatch::Alarm", "Properties": { "AlarmDescription": "Scale-down if CPU
< 75% for 10 minutes", "MetricName": "CPUUtilization", "Namespace": "AWS/EC2", "Statistic": "Average", "Period": "300", "EvaluationPeriods": "2", "Threshold": "75", "AlarmActions": [{ "Ref": "AppServerScaleDownPolicy"}], "Dimensions": [{ "Name": "AutoScalingGroupName", "Value": { "Ref": "AppServerGroup"}}], "ComparisonOperator": "LessThanThreshold" }}, 26
“appserverstrata1uxit": { "Type": "AWS::ElasticLoadBalancing::LoadBalancer", "Properties": { "AvailabilityZones": { "Fn::GetAZs": ""},
"HealthCheck": { "HealthyThreshold": "10", "Interval": "30", "Target": "HTTP:8080/healthcheck", "Timeout": "2", "UnhealthyThreshold": "2" }, "Listeners": [{ "InstancePort": "8080", "LoadBalancerPort": "80", "Protocol": "HTTP", "PolicyNames": [] }]}}, 27
"ChefClient": { "Type": "AWS::AutoScaling::LaunchConfiguration", "DependsOn": "BucketPolicy", "Metadata": { "AWS::CloudFormation::Init": {
"config": { "packages": { "rubygems": { "chef": [],"ohai": ["0.6.4"] }, "apt": { "build-essential": [],"ruby": [],"rubygems": [] }}, 28
"files": { "/etc/chef/first-boot.json": { "content": { "run_list": { "Ref": "ChefRunList“
}, "mode": "000644", "owner": "root", "group": "root" }}, "/home/ubuntu/.s3cfg": { "content": { "Fn::Join": ["", ["[default]\n", "access_key = ", { "Ref": "HostKeys" \}, "\n", "secret_key = ", { "Fn::GetAtt": ["HostKeys", "SecretAccessKey"] }, "\n", "use_https = True\n"]]}, "mode": "000644", "owner": "ubuntu", "group": "ubuntu" }, 29
"Properties": { "SecurityGroups": [ { "Ref": “AppServerAccess" } ], "ImageId":
{ "Fn::FindInMap": ["AWSRegionArch2AMI", { "Ref": "AWS::Region" }, { "Fn::FindInMap": ["AWSInstanceType2Arch", { "Ref": "InstanceType" }, "Arch“ ]}]}, "KeyName": { "Ref": "KeyName" }, "InstanceType": { "Ref": "InstanceType" } 30
"UserData": { "Fn::Base64": { "Fn::Join": ["", ["#!/bin/bash -v\n", "function error_exit\n",
"{\n", " cfn-signal -e 1 -r \"$1\" '", { "Ref": "ChefClientWaitHandle“ }, "chef-client -j /etc/chef/first-boot.json ||”, “error_exit 'Failed to initialize host via chef client' \n", "# If all went well, signal success\n", "cfn-signal -e $? -r 'Chef Server configuration' '", { "Ref": "ChefClientWaitHandle" }, "'\n“ } 31
32
33
34
35
36
Jeremy Przygode
[email protected]
www.stratalux.com @stratalux Special thanks to JD Hancock
for the awesome images! http://www.flickr.com/photos/jdhancock/ 37