SlideShare a Scribd company logo
©	2016,	Amazon	Web	Services,	Inc.	or	its	Affiliates.	All	rights	reserved.
Leon	Li,	李磊,	AWS解决方案架构师
2016/09/08
AWS云端多环境自动化运维和部署
议程
基础设施代码化
云端的多环境管理
高效的自动化部署
为什么基础设施代码化很重要
结构化 高效 健壮 安全
基础设施即代码的实现
监控配置部署测试构建代码
Elastic Beanstalk
OpsWorks
Cloud
Watch
Cloud
Formation
Code
Deploy
Code
Commit
Code
Pipeline
软件开发类比基础设施代码化
应用程序
Source	code
Interpreter
Desired	application	state
基础设施
JSON
AWS	Service	API
Desired	infrastructure	
state
软件开发类比基础设施代码化
应用程序
软件代码
Interpreter
Desired	application	state
基础设施
JSON
AWS	Service	API
Desired	infrastructure	
state
软件开发类比基础设施代码化
应用程序
软件代码
编译器/运行时
Desired	application	state
基础设施
JSON
AWS服务API
Desired	infrastructure	
state
软件开发类比基础设施代码化
应用程序
软件代码
编译器/运行时
目标应用程序状态
基础设施
JSON
AWS服务API
目标基础设施状态
重
用
扩
展
测
试
维
护
重用– 多环境
Development
IaC Template
Development
Production
IaC Template
重用– 多环境
Development
Production
Forensics Analysis
IaC Template
重用– 多环境
维护– 与CI/CD集成
App	Developers
IaC	Template
Story
App	Source
Code
App	Developers
IaC	Template
Story
AWS	CodeCommit
Source	Control
App	Source
Code
维护– 与CI/CD集成
AWS
CloudFormation
App	Developers
AWS	CodePipeline
IaC	Template
Story
AWS	CodeCommit
Source	Control
AWS	CodeDeploy
App	Source
Code
维护– 与CI/CD集成
AWS
CloudFormation
App	Developers
AWS	CodePipeline
Dev
Staging
Prod
IaC	Template
Story
AWS	CodeCommit
Source	Control
AWS	CodeDeploy
App	Source
Code
维护– 与CI/CD集成
AWS
CloudFormation
App	Developers
AWS	CodePipeline
Dev
Staging
Prod
IaC	Template
Story
AWS	CodeCommit
Source	Control
AWS	CodeDeploy
App	Source
Code
维护– 与CI/CD集成
扩展– AWS	Lambda自定义资源
IaC Template
IaC Template
AWS Lambda
扩展– AWS	Lambda自定义资源
Cross-stack reference: VPC
Cross-stack reference:
Security Group
Cross-stack reference:
Subnet
Look up AMI ID
Utility function – e.g., string
reversal
IaC Template
扩展– AWS	Lambda自定义资源
Cross-stack reference: VPC
Cross-stack reference:
Security Group
Cross-stack reference:
Subnet
Look up AMI ID
Utility function – e.g., string
reversal
IaC Template
扩展– AWS	Lambda自定义资源
测试 – 蓝绿部署
ExampleApp V1
IaC Template
测试 – 蓝绿部署
AWS CodeDeploy
ExampleApp V1
ExampleApp V2
IaC Template
测试 – 蓝绿部署
AWS CodeDeploy
ExampleApp V1
ExampleApp V2
IaC Template
模板 CloudFormation 堆栈
JSON 格式的文件
参数定义
需要的资源
具体配置
配置好的AWS资源
完整的SAWS服务支持
可定制化
框架
创建堆栈
更新堆栈
错误检查和回滚
CloudFormation – 组件和技术实现
价格
$0.00
CloudFormation示例
{
"Description" : "A text description for the template usage",
"Parameters": {
// A set of inputs used to customize the template per deployment
},
"Resources" : {
// The set of AWS resources and relationships between them
},
"Outputs" : {
// A set of values to be made visible to the stack creator
},
"AWSTemplateFormatVersion" : "2010-09-09”
}
Aws summit devops   云端多环境自动化运维和部署
Reference
{ "Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
"KeyName" : "mykey",
"ImageId" : "ami-7a11e213”
}
},
"InstanceSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Enable SSH access via port 22",
"SecurityGroupIngress" : [ {
"IpProtocol" : "tcp",
"FromPort" : "22",
"ToPort" : "22",
"CidrIp" :"0.0.0.0/0" } ]
}
}
} }
Input	Reference
{
"Parameters" : {
"KeyPair" : {
"Description" : "The EC2 Key Pair to allow SSH access to the instance",
"Type" : "String"
},
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" }],
"KeyName" : { "Ref" : "KeyPair"},
"ImageId" : "" }
},
…
} }
自定义input参数
"WordPressUser": {
"Default": "admin",
"Description" : "The WordPress database admin account username",
"Type": "String",
"MinLength": "1",
"MaxLength": "16",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*"
},
使用下列属性来验证input参数 :
Maxlength, MinLength, MaxValue, MinValue, AllowedPattern, AllowedValues
Mappings
{"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" },
"ap-northeast-1" : { "AMI" : "ami-8e08a38f" } } },
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
“ImageId" : {
"Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}
}
}
} }
服务器初始化 - UserData
AWS code services
AWS CodeCommit AWS CodePipeline AWS CodeDeploy
源码控制 - CodeCommit
Private Git repositories hosted on Amazon S3
• 基于Amazon的私有Git Repositories
• 完全兼容Git
• 充分利用云的优势 (扩展性,持久性, 可靠性, 按需付费以降低成本)
• Repositories没有大小限制
• 在线代码工具,支持browse, edit, diff
• IAM用户管理
持续交付 - CodePipeline
• 可自定义的自动化版本发布,并且集成了编译和测试
• 对自定义的版本发布工作流建模、可视化
(源代码 è 编译 è beta è gamma è 线上生产)
• 自动化编译、测试和部署
• 执行自定义规则
• 与第三方工具集成
36
Aws summit devops   云端多环境自动化运维和部署
持续部署 - CodeDeploy
• 协调服务器的软件更新,滚动更新以避免宕机时间
• 针对部署的健康检测,以及回滚
• 集成自动扩展(Auto Scaling)
• 对所有应用程序适用
• 重用已有的部署工具
(Bash, Powershell, Chef, Puppet…)
38
工作流
9/25/14 Slides	not	intended	for	redistribution. 40
AppSpec fileos: linux
files:
- source: Config/config.txt
destination: webapps/Config
- source: Service
destination: /webapps/DogSuit
hooks:
ApplicationStop:
- location: Scripts/Deactivate_Service
BeforeInstall:
- location: Scripts/Flush_Logs.sh
AfterInstall:
- location: Scripts/Decrypt_Secrets.sh
ApplicationStart:
- location: Scripts/Start_Pooch_Service.sh
timeout: 3600
ValidateService:
- location: Scripts/Check_Dogs_Barking.sh
runas: codedeployuser
ApplicationStop
BeforeInstall
AfterInstall
ApplicationStart
ValidateService
DownloadBundle
Install
Start
End
部署配置
v2 v2 v2 v2 v2 v2 v2 v2All-at-once
Min. healthy hosts = 0
v2 v2 v2 v2 v1 v1 v1 v1Half-at-a-time
Min. healthy hosts = 50%
v2 v2 v1 v1 v1 v1 v1 v1[Custom]
Min. healthy hosts = 75%
v2 v1 v1 v1 v1 v1 v1 v1One-at-a-time
Min. healthy hosts = 99%
第三方工具集成
AWS DevOps 服务
运维
Elastic Beanstalk
CloudWatch
CloudFormationCodeDeploy
CodePipeline
Opsworks
Elastic Container Service
监控搭建部署测试构建开发
Lambda
CloudTrail
版本管理 持续集成
持续交付
持续部署
自动化运维
配置管理
自动化监控基础设施即代码
日志管理
CodeCommit
Thank	you.

More Related Content

PDF
ServerlessConf Tokyo キーノート
PDF
Riot Games 글로벌 게임 운영을 위한 Docker 및 Amazon ECS 활용사례 - AWS Summit Seoul 2017
PDF
基于Aws的持续集成、交付和部署 代闻
PDF
Getting Started with Docker on AWS
PDF
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
PDF
Getting Started with AWS Lambda and Serverless Computing
PDF
서버리스(Serverless) 프레임웍 비교 - ClaudiaJS와 Chalice를 중심으로 (윤석찬)
PDF
Serverless api gateway + lambda
ServerlessConf Tokyo キーノート
Riot Games 글로벌 게임 운영을 위한 Docker 및 Amazon ECS 활용사례 - AWS Summit Seoul 2017
基于Aws的持续集成、交付和部署 代闻
Getting Started with Docker on AWS
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
Getting Started with AWS Lambda and Serverless Computing
서버리스(Serverless) 프레임웍 비교 - ClaudiaJS와 Chalice를 중심으로 (윤석찬)
Serverless api gateway + lambda

Viewers also liked (13)

PPTX
AWS ELB Tips & Best Practices
PDF
基于Aws的dev ops实践指南 王毅
PDF
零到千万可扩展架构 AWS Architecture Overview
PPTX
AWS Summit OaaS Talk by ChinaNetCloud
PPTX
AWS EC2 and ELB troubleshooting
PDF
淺談系統監控與 AWS CloudWatch 的應用
PPTX
Autoscaling Spark on AWS EC2 - 11th Spark London meetup
PDF
Getting Started with AWS EC2. From Zero to Hero
PDF
Building microservices in python @ pycon2017
PDF
AwSome day 分享
PPTX
OpsStack--Integrated Operation Platform
PPTX
Internet Cloud Operations - ChinaNetcloud & AWS Event Beijing
PDF
Aws容器服务详解
AWS ELB Tips & Best Practices
基于Aws的dev ops实践指南 王毅
零到千万可扩展架构 AWS Architecture Overview
AWS Summit OaaS Talk by ChinaNetCloud
AWS EC2 and ELB troubleshooting
淺談系統監控與 AWS CloudWatch 的應用
Autoscaling Spark on AWS EC2 - 11th Spark London meetup
Getting Started with AWS EC2. From Zero to Hero
Building microservices in python @ pycon2017
AwSome day 分享
OpsStack--Integrated Operation Platform
Internet Cloud Operations - ChinaNetcloud & AWS Event Beijing
Aws容器服务详解
Ad

Similar to Aws summit devops 云端多环境自动化运维和部署 (13)

PDF
Scalable and Fault-Tolerant Apps with AWS
PPTX
AWS SSA Webinar 30 - Getting Started with AWS - Infrastructure as Code - Terr...
PPTX
Programando sua infraestrutura com o AWS CloudFormation
PDF
Development in the could: How do we do it(Cloud computing. Microservices. Faas)
PDF
ITCamp 2018 - Magnus Mårtensson - Azure Resource Manager For The Win
PPTX
Craig Johnson When VPCs Attack: Real-Life Cloud Networking Fails (and Fixes)
PDF
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
PDF
2013 05-openstack-israel-heat
PPTX
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
PDF
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
PDF
Devops on serverless
PDF
Infrastructure as Code: Manage your Architecture with Git
PPTX
StrongLoop Overview
Scalable and Fault-Tolerant Apps with AWS
AWS SSA Webinar 30 - Getting Started with AWS - Infrastructure as Code - Terr...
Programando sua infraestrutura com o AWS CloudFormation
Development in the could: How do we do it(Cloud computing. Microservices. Faas)
ITCamp 2018 - Magnus Mårtensson - Azure Resource Manager For The Win
Craig Johnson When VPCs Attack: Real-Life Cloud Networking Fails (and Fixes)
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
2013 05-openstack-israel-heat
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Devops on serverless
Infrastructure as Code: Manage your Architecture with Git
StrongLoop Overview
Ad

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
Teaching material agriculture food technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
KodekX | Application Modernization Development
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Network Security Unit 5.pdf for BCA BBA.
Teaching material agriculture food technology
Dropbox Q2 2025 Financial Results & Investor Presentation
MIND Revenue Release Quarter 2 2025 Press Release
The Rise and Fall of 3GPP – Time for a Sabbatical?
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation theory and applications.pdf
Unlocking AI with Model Context Protocol (MCP)
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
KodekX | Application Modernization Development
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Aws summit devops 云端多环境自动化运维和部署