VPC
目標 1 : 創建 VPC
step1 : 左上角 “Service” 下拉選單>VPC
step2 : 右上角將地區調整為> Asia Pacific Tokyo
step3 : 左邊橫欄點選 Your VPCs
* 注意:這裏使用 safari 的用戶會看到一片空白,請改用其他瀏覽器
step4 : 點選藍色框框的 Create VPC
* Name tag : Gerneral_VPC * IPv4 CIDR block* : 10.10.0.0/16
目標 2 : 創建 Internet Gateways
step1 : 左邊橫欄點選 Internet Gateways
step2 : create internet gateway
* Name: General_igw * attach to VPC 選擇 vpc-18ca0c7f| Gerneral_VPC
目標 3 : 創建 Route Tables
step1 : 左邊橫欄點選 Route Tables
step2 : create route table
* Name : General_rt_public
step3 : 拉到最下面 Routes,點選 edit
* Add another route
Destination Target 0.0.0.0/0 igw-XXX--- ( 剛剛創好的 General_igw 的 ID )
目標 4 : 創建 Subnets
包含 public subnet(公網域)及 private subnet(私網域),同樣的步驟做兩遍,但設定略有不同喔
step1 : 左邊橫欄點選 Subnets
step2 : create subnet
* Name: General_subnet_public ( General_subnet_private )
* VPC 選擇 Gerneral_VPC
* IPV4:10.10.110.0/24 ( 10.10.220.0/24 )
step3 : 點選 General_subnet_public
* 讓 public subnet 可以上網
step4 : 拉到最下面 Routes,點選 edit
step5 : change to rtb-63f28804 | General_rt_public ( 公網段的 routetable )
目標 5 : 創建 Security Groups
step1 : 左邊橫欄點選 Security Groups
step2 : create security groups
* Name : General_SG_<服務名> * Description : security group for <服務名> * VPC : 選擇 vpc-18ca0c7f | Gerneral_VPC
step3 : 拉到下面點選 Inbound Rules 點 edit
step4 : 設定 Inbound 限制 限制協定、Port、來源 IP
* Type 選擇 HTTP(80) * Port range : 80 * source:0.0.0.0/0
===Security groups SG inbound rules 設定參考===
Django
tcp 8000 0.0.0.0/0
tcp 22 10.10.0.0/16
MySQL
tcp 3306 10.10.0.0/16
tcp 22 10.10.0.0/16
MongoDB
tcp 27017 10.10.0.0/16
tcp 22 10.10.0.0/16
HDFS+Spark+Kafka
* 規格需要視情況調整
all traffic 10.10.0.0/16
https://www.cloudera.com/documentation/enterprise/5-12-x/topics/quickstart_docker_container.html
需確認此 docker 版本是否有包含此三種服務
Bastion
tcp 22 0.0.0.0/0
目標 6 : 創建 NAT gateways
step1 : 左邊橫欄點選 NAT gateways
step2 : Create NAT Gateway
* Subnet 選擇 General_subnet_public * Elastic IP Allocation ID 按 Create New EIP
step3 : 按下方 Create a NAT Gateway
step4 : 再按 edit route tables 點選 General_rt_private
step5 : 拉到下面選 Routes 點 edit
* Destination 填入 0.0.0.0/0 * Target 選擇 <natgateway_id>
step6 : 點選 save
* 從此以後 private subnet 裡面的機器就可以透過 NAT gateway 上網囉
* NAT gateway 不用時務必刪除,因為它以小時與流量計價,下次要用時再創
* Elastic IP 也要刪除 release,不然放在那超過一小時 if not attached to any instance 也會收錢QQ 血淚分享xD