aws(学习笔记第十二课) 使用AWS的RDS-MySQL

aws(学习笔记第十二课)

  • 使用AWS的RDS

学习内容:

  • AWS的RDS-MySQL

1. 使用AWS的RDS

  1. 什么是RDS
    RDS就是Relation Database Service的缩写,是AWS提供的托管关系型数据库系统。让用户能够在 AWS Cloud 云中更轻松地设置、操作和扩展关系数据库。

    • 数据库和web server服务器下的架构
      在这里插入图片描述
  2. 使用Cloudformation构建RDS以及AutoScaling
    注意mail地址的时候,要指定postgresql@163.com的形式,要用@加上domain的形式,否则,下面的wordpressinstall会报错,导致该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"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值