* Use CloudFormation to create Stacks composed of VPC, Internet Gateway, Route Table, ELB, EC2 Instance, EBS Volumes
* Single pattern with EC2 Instances WEB server and DB server with the same AZ
* Redundant pattern with EC2 Instances WEB server and DB server with multi-AZ
3. Overview
•
•
•
•
•
Use CloudFormation to create Stacks composed of VPC, Internet Gateway, Route
Table, ELB, EC2 Instance, EBS Volumes
Single pattern with EC2 Instances WEB server and DB server with the same AZ
Redundant pattern with EC2 Instances WEB server and DB server with multi-AZ
Install LAMP package with Cloud-init
Add & resize another EBS Volumes for WEB server and DB Server
Stack – redundant pattern
Stack – single pattern
AWS CloudFormation
Amazon VPC
Elastic Load
Balancing
WEB on
Instance
Availability Zone
Internet
Gateway
DB on
Instance
WEB on
Instance
DB on
Instance
Availability Zone
Elastic Load
Balancing
DB on
Instance
WEB on
Instance
Route Table
Availability Zone
2014/3/1
3
4. System Architecture - Network
vpc.template
Name
AvailabilityZone
Role
SubnetPublicVarA00 ap-northeast-1a ELB
SubnetPublicVarC01 ap-northeast-1c ELB
SubnetPublicVarA02 ap-northeast-1a Instances in AutoScaling Group
SubnetPublicVarC03 ap-northeast-1c Instances in AutoScaling Group
SubnetPublicFixA08 ap-northeast-1a Instances in Fixed IP address
SubnetPublicFixC09 ap-northeast-1c Instances in Fixed IP address
2014/3/1
4
6. Template Structure - Dependency & Resources
Single
Redundant
① cloudformation-redundant.template
① cloudformation-single.template
AWS::CloudFormation::Stack
AWS::CloudFormation::Stack
② vpc.template
AWS::EC2::InternetGateway
AWS::EC2::NetworkAcl
AWS::EC2::NetworkAclEntry
AWS::EC2::Route
AWS::EC2::RouteTable
③ ec2-single.template
AWS::EC2::Subnet
AWS::EC2::SubnetNetworkAclAssociation
AWS::EC2::SubnetRouteTableAssociation
AWS::EC2::VPC
AWS::EC2::VPCGatewayAttachment
AWS::CloudFormation::WaitCondition
AWS::CloudFormation::WaitConditionHandle
AWS::EC2::EIP
AWS::EC2::Instance
AWS::EC2::SecurityGroup
AWS::ElasticLoadBalancing::LoadBalancer
③ ec2-redundant.template
AWS::CloudFormation::WaitCondition
AWS::CloudFormation::WaitConditionHandle
AWS::EC2::EIP
AWS::EC2::Instance
AWS::EC2::SecurityGroup
AWS::ElasticLoadBalancing::LoadBalancer
2014/3/1
6
7. Template Structure - Function overview
Single
Redundant
cloudformation-redundant.template
cloudformation-single.template
Base template for single, redundant pattern
Add output values from nested stacks
Input key to the following items(values):
VPC CIDR, Instance Type, Volume Size, SSH KeyName, SecurityGroup CIDR(Customer’s GW, Office GW, Monitoring Server’s GW),
DB Root Password
Pass the parameters to the nested stack
Output the parameters
VPC CIDR, Subnet ID , Instance Type, Instance ID, EIP, Volume Size, SecurityGroup CIDR(Customer GW, Own Office GW,
Monitoring Server GW)
vpc.template
Common template for single, redundant pattern
Create the following resources:
VPC, Subnet, Network ACL, Internet GW, Routing Table
ec2-single.template
ec2-redundant.template
EC2 resource template for single, redundant pattern
Create the following resources:
Instance, EBS Volume, ELB, EIP, Security Groups
Install Apache, PHP, MySQL
Enable/Disable the services will be started automatically upon boot
Create a linux user, opuser for
Attach another EBS Volumes, create file system and resize them
2014/3/1
7
8. Template Structure - RPM packages
• Common
o gcc, gcc-c++, make, wget, unzip, git, ntp, openssl
o sendmail, postfix
• WEB Server
o mod_ssl, httpd, httpd-devel, httpd-tools
• DB Server
o mysql, mysql-devel, mysql-embedded-devel, mysql-libs, mysql-server
※Using MySQL Community repository(http://repo.mysql.com/mysql-communityrelease-el6.rpm) to install MySQL via yum on CentOS.
2014/3/1
8
9. Operation Manual - AWS CLI (1)
Precondition
• Login to Amazon Linux AMI to deploy stack.
• Grant IAM Role with administrator privilege on the
instance.
2014/3/1
9