Skip to content

Instantly share code, notes, and snippets.

@boris
Last active January 28, 2018 05:40
Show Gist options
  • Save boris/30538cb3e89cac221914b5e816c70c0a to your computer and use it in GitHub Desktop.
Save boris/30538cb3e89cac221914b5e816c70c0a to your computer and use it in GitHub Desktop.
Creación de VPC en AWS
= VPC
1. Crear VPC, asignar rango de IP (10.0.0.0/16)
2. Crear al menos
- Una subnet pública (10.0.1.0/24)
- Una subnet privada (10.0.2.0/24)
3. Crear un Internet Gateway y atacharlo a la VPC
4. Crear un NAT Gateway (debe estar en la VPC pública)
5. Routing table
- Asignar la subnet pública al Internet GW con destination 0.0.0.0/0
- Asingar la subnet privada al NAT GW con destination 0.0.0.0/0
---
= AWS CLI version
aws ec2 create-vpc --cidr-block 10.240.0.0/16
aws ec2 create-subnet --vpc-id <VPC-ID> --cidr-block 10.240.1.0/24 #private
aws ec2 create-subnet --vpc-id <VPC-ID> --cidr-block 10.240.2.0/24 #public
aws ec2 create-internet-gateway
aws ec2 attach-internet-gateway --vpc-id <VPC-ID> --internet-gateway-id <IGW-ID>
aws ec2 create-route-table --vpc-id <VPC-ID>
aws ec2 create-route --route-table-id <RouteTable-ID> --destination-cidr-block 0.0.0.0/0 --gateway-id <IGW-ID>
aws ec2 associate-route-table --subnet-id <PublicSubnet-ID> --route-table-id <RouteTable-ID>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment