add support for AWS

pull/48/merge
Kelsey Hightower 2016-09-11 02:40:34 -07:00
parent 5d794d8280
commit ed7b9fc2da
2 changed files with 184 additions and 4 deletions

View File

@ -18,6 +18,12 @@ VPC_ID=$(aws ec2 create-vpc \
jq -r '.Vpc.VpcId') jq -r '.Vpc.VpcId')
``` ```
```
aws ec2 create-tags \
--resources ${VPC_ID} \
--tags Key=Name,Value=kubernetes
```
``` ```
aws ec2 modify-vpc-attribute \ aws ec2 modify-vpc-attribute \
--vpc-id ${VPC_ID} \ --vpc-id ${VPC_ID} \
@ -37,6 +43,12 @@ DHCP_OPTION_SET_ID=$(aws ec2 create-dhcp-options \
jq -r '.DhcpOptions.DhcpOptionsId') jq -r '.DhcpOptions.DhcpOptionsId')
``` ```
```
aws ec2 create-tags \
--resources ${DHCP_OPTION_SET_ID} \
--tags Key=Name,Value=kubernetes
```
``` ```
aws ec2 associate-dhcp-options \ aws ec2 associate-dhcp-options \
--dhcp-options-id ${DHCP_OPTION_SET_ID} \ --dhcp-options-id ${DHCP_OPTION_SET_ID} \
@ -52,6 +64,12 @@ SUBNET_ID=$(aws ec2 create-subnet \
jq -r '.Subnet.SubnetId') jq -r '.Subnet.SubnetId')
``` ```
```
aws ec2 create-tags \
--resources ${SUBNET_ID} \
--tags Key=Name,Value=kubernetes
```
Create an internet gateway Create an internet gateway
``` ```
@ -59,6 +77,12 @@ INTERNET_GATEWAY_ID=$(aws ec2 create-internet-gateway | \
jq -r '.InternetGateway.InternetGatewayId') jq -r '.InternetGateway.InternetGatewayId')
``` ```
```
aws ec2 create-tags \
--resources ${INTERNET_GATEWAY_ID} \
--tags Key=Name,Value=kubernetes
```
``` ```
aws ec2 attach-internet-gateway \ aws ec2 attach-internet-gateway \
--internet-gateway-id ${INTERNET_GATEWAY_ID} \ --internet-gateway-id ${INTERNET_GATEWAY_ID} \
@ -73,6 +97,12 @@ ROUTE_TABLE_ID=$(aws ec2 create-route-table \
jq -r '.RouteTable.RouteTableId') jq -r '.RouteTable.RouteTableId')
``` ```
```
aws ec2 create-tags \
--resources ${ROUTE_TABLE_ID} \
--tags Key=Name,Value=kubernetes
```
``` ```
aws ec2 associate-route-table \ aws ec2 associate-route-table \
--route-table-id ${ROUTE_TABLE_ID} \ --route-table-id ${ROUTE_TABLE_ID} \
@ -96,6 +126,12 @@ SECURITY_GROUP_ID=$(aws ec2 create-security-group \
jq -r '.GroupId') jq -r '.GroupId')
``` ```
```
aws ec2 create-tags \
--resources ${SECURITY_GROUP_ID} \
--tags Key=Name,Value=kubernetes
```
``` ```
aws ec2 authorize-security-group-ingress \ aws ec2 authorize-security-group-ingress \
--group-id ${SECURITY_GROUP_ID} \ --group-id ${SECURITY_GROUP_ID} \

View File

@ -1,6 +1,8 @@
# Cleaning Up # Cleaning Up
## Virtual Machines ## GCP
### Virtual Machines
``` ```
gcloud compute instances delete \ gcloud compute instances delete \
@ -9,8 +11,7 @@ gcloud compute instances delete \
etcd0 etcd1 etcd2 etcd0 etcd1 etcd2
``` ```
## Networking ### Networking
``` ```
gcloud compute forwarding-rules delete kubernetes-rule gcloud compute forwarding-rules delete kubernetes-rule
@ -53,4 +54,147 @@ gcloud compute networks subnets delete kubernetes
``` ```
gcloud compute networks delete kubernetes gcloud compute networks delete kubernetes
``` ```
## AWS
### VMs
```
KUBERNETES_HOSTS=(controller0 controller1 controller2 etcd0 etcd1 etcd2 worker0 worker1 worker2)
```
```
for host in ${KUBERNETES_HOSTS[*]}; do
INSTANCE_ID=$(aws ec2 describe-instances \
--filters "Name=tag:Name,Values=${host}" | \
jq -j '.Reservations[].Instances[].InstanceId')
aws ec2 terminate-instances --instance-ids ${INSTANCE_ID}
done
```
### IAM
```
aws iam remove-role-from-instance-profile \
--instance-profile-name kubernetes \
--role-name kubernetes
```
```
aws iam delete-instance-profile \
--instance-profile-name kubernetes
```
```
aws iam delete-role-policy \
--role-name kubernetes \
--policy-name kubernetes
```
```
aws iam delete-role --role-name kubernetes
```
### SSH Keys
```
aws ec2 delete-key-pair --key-name kubernetes
```
### Networking
#### Load Balancers
```
aws elb delete-load-balancer \
--load-balancer-name kubernetes
```
#### Security Groups
```
SECURITY_GROUP_ID=$(aws ec2 describe-security-groups \
--filters "Name=tag:Name,Values=kubernetes" | \
jq -r '.SecurityGroups[].GroupId')
```
```
aws ec2 delete-security-group \
--group-id ${SECURITY_GROUP_ID}
```
#### Internet Gateways
```
VPC_ID=$(aws ec2 describe-vpcs \
--filters "Name=tag:Name,Values=kubernetes" | \
jq -r '.Vpcs[].VpcId')
```
```
INTERNET_GATEWAY_ID=$(aws ec2 describe-internet-gateways \
--filters "Name=tag:Name,Values=kubernetes" | \
jq -r '.InternetGateways[].InternetGatewayId')
```
```
aws ec2 detach-internet-gateway \
--internet-gateway-id ${INTERNET_GATEWAY_ID} \
--vpc-id ${VPC_ID}
```
```
aws ec2 delete-internet-gateway \
--internet-gateway-id ${INTERNET_GATEWAY_ID}
```
#### Route Tables
```
ROUTE_TABLE_ID=$(aws ec2 describe-route-tables \
--filters "Name=tag:Name,Values=kubernetes" | \
jq -r '.RouteTables[].RouteTableId')
```
```
aws ec2 delete-route-table --route-table-id ${ROUTE_TABLE_ID}
```
#### Subnets
```
SUBNET_ID=$(aws ec2 describe-subnets \
--filters "Name=tag:Name,Values=kubernetes" | \
jq -r '.Subnets[].SubnetId')
```
```
aws ec2 delete-subnet --subnet-id ${SUBNET_ID}
```
#### VPC
```
VPC_ID=$(aws ec2 describe-vpcs \
--filters "Name=tag:Name,Values=kubernetes" | \
jq -r '.Vpcs[].VpcId')
```
```
aws ec2 delete-vpc --vpc-id ${VPC_ID}
```
#### DHCP Option Sets
```
DHCP_OPTION_SET_ID=$(aws ec2 describe-dhcp-options \
--filters "Name=tag:Name,Values=kubernetes" | \
jq -r '.DhcpOptions[].DhcpOptionsId')
```
```
aws ec2 delete-dhcp-options \
--dhcp-options-id ${DHCP_OPTION_SET_ID}
```