Difference between revisions of "Aws vpc"
From Wasya Wiki
(Created page with " ## uses default security group aws ec2 run-instances --image-id ami-068cf3d51efeb20d6 \ --count 1 --instance-type t2.micro \ --key-name idrsa_ecs_key2 \ --subnet-id s...") |
(No difference)
|
Revision as of 00:06, 30 March 2024
- uses default security group
aws ec2 run-instances --image-id ami-068cf3d51efeb20d6 \
--count 1 --instance-type t2.micro \ --key-name idrsa_ecs_key2 \ --subnet-id subnet-063bc531077168036 \ --associate-public-ip-address \ --profile rds_driver_1
i-00eb03109e916ab9f
VPC
us-east-2(a)
aws ec2 create-vpc --cidr-block 10.0.0.0/24 \ --query Vpc.VpcId \ --output text \ --profile ecs_driver_1
vpc-00ffb72190031b346
aws ec2 create-subnet --vpc-id vpc-00ffb72190031b346 \ --cidr-block 10.0.0.64/26 \ --availability-zone us-east-2a \ --query Subnet.SubnetId \ --output text \ --profile ecs_driver_1
subnet-063bc531077168036
aws ec2 create-internet-gateway --query InternetGateway.InternetGatewayId \ --output text \ --profile ecs_driver_1
igw-0f28244d5bfcc5ffd
aws ec2 attach-internet-gateway --vpc-id vpc-00ffb72190031b346 \ --internet-gateway-id igw-0f28244d5bfcc5ffd \ --profile ecs_driver_1
aws ec2 create-route-table --vpc-id vpc-00ffb72190031b346 \ --query RouteTable.RouteTableId \ --output text \ --profile ecs_driver_1
rtb-0dea7dc17e6063ad8
aws ec2 create-route --route-table-id rtb-0dea7dc17e6063ad8 \ --destination-cidr-block 0.0.0.0/0 \ --gateway-id igw-0f28244d5bfcc5ffd \ --profile ecs_driver_1
aws ec2 associate-route-table --route-table-id rtb-0dea7dc17e6063ad8 \ --subnet-id subnet-063bc531077168036 \ --profile ecs_driver_1
Troubleshoot
Add an inbound rule to security group
From: https://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html
aws ec2 authorize-security-group-ingress \ --group-id sg-1234567890abcdef0 \ --protocol tcp \ --port 22 \ --cidr 203.0.113.0/24