aws(学习笔记第十二课)
- 使用AWS的
RDS
学习内容:
- AWS的
RDS
-MySQL
1. 使用AWS的RDS
-
什么是
RDS
RDS
就是Relation Database Service
的缩写,是AWS
提供的托管关系型数据库系统。让用户能够在 AWS Cloud 云中更轻松地设置、操作和扩展关系数据库。- 数据库和
web server
服务器下的架构
- 数据库和
-
使用
Cloudformation
构建RDS
以及AutoScaling
注意mail
地址的时候,要指定postgresql@163.com的形式,要用@加上domain
的形式,否则,下面的wordpress
的install
会报错,导致该cloudformation
创建失败Cloudformation
代码{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "AWS in Action: chapter 9", "Parameters": { "KeyName": { "Description": "Key Pair name", "Type": "AWS::EC2::KeyPair::KeyName", "Default": "my-cli-key" }, "BlogTitle": { "Description": "The title of the blog.", "Type": "String", "Default": "Amazon Web Services in Action - Example" }, "AdminUsername": { "Description": "A username for admin.", "Type": "String", "Default": "admin" }, "AdminPassword": { "Description": "A password for admin", "Type": "String", "NoEcho": "true" }, "AdminEMail": { "Description": "The email address of the administrator.", "Type": "String" } }, "Mappings": { "EC2RegionMap": { "ap-northeast-1": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-cbf90ecb"}, "ap-southeast-1": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-68d8e93a"}, "ap-southeast-2": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-fd9cecc7"}, "eu-central-1": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-a8221fb5"}, "eu-west-1": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-a10897d6"}, "sa-east-1": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-b52890a8"}, "us-east-1": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-1ecae776"}, "us-west-1": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-d114f295"}, "us-west-2": { "AmazonLinuxAMIHVMEBSBacked64bit": "ami-e7527ed7"} } }, "Resources": { "VPC": { "Type": "AWS::EC2::VPC", "Properties": { "CidrBlock": "172.31.0.0/16", "EnableDnsHostnames": "true" } }, "InternetGateway": { "Type": "AWS::EC2::InternetGateway", "Properties": { } }, "VPCGatewayAttachment": { "Type": "AWS::EC2::VPCGatewayAttachment", "Properties": { "VpcId": { "Ref": "VPC"}, "InternetGatewayId": { "Ref": "InternetGateway"} } }, "SubnetA": { "Type": "AWS::EC2::Subnet", "Properties": { "AvailabilityZone": { "Fn::Select": ["0", { "Fn::GetAZs": ""}]}, "CidrBlock": "172.31.38.0/24", "VpcId": { "Ref": "VPC"} } }, "SubnetB": { "Type": "AWS::EC2::Subnet", "Properties": { "AvailabilityZone": { "Fn::Select": ["1", { "Fn::GetAZs": ""}]}, "CidrBlock": "172.31.37.0/24", "VpcId": { "Ref": "VPC"} } }, "RouteTable": { "Type": "AWS::EC2::RouteTable", "Properties": { "VpcId": { "Ref": "VPC"} } }, "RouteTableAssociationA": { "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "SubnetId": { "Ref": "SubnetA"}, "RouteTableId": { "Ref": "RouteTable"} } }, "RouteTableAssociationB": { "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "SubnetId": { "Ref": "SubnetB"}, "RouteTableId": { "Ref": "RouteTable"} } }, "RoutePublicNATToInternet": { "Type": "AWS::EC2::Route", "Properties": { "RouteTableId": { "Ref": "RouteTable"}, "DestinationCidrBlock": "0.0.0.0/0", "GatewayId": { "Ref": "InternetGateway"} }, "DependsOn": "VPCGatewayAttachment" }, "NetworkAcl": { "Type": "AWS::EC2::NetworkAcl", "Properties": { "VpcId": { "Ref": "VPC"} } }, "SubnetNetworkAclAssociationA": { "Type": "AWS::EC2::SubnetNetworkAclAssociation", "Properties": { "SubnetId": { "Ref": "SubnetA"}, "NetworkAclId": { "Ref": "NetworkAcl"} } }, "SubnetNetworkAclAssociationB": { "Type": "AWS::EC2::SubnetNetworkAclAssociation", "Properties": { "SubnetId": { "Ref": "SubnetB"}, "NetworkAclId": { "Ref": "NetworkAcl"} } }, "NetworkAclEntryIngress": { "Type": "AWS::EC2::NetworkAclEntry", "Properties": { "NetworkAclId": { "Ref": "NetworkAcl"}, "RuleNumber": "100", "Protocol"