amazon web services - AWS create vpc and launch instance -


i trying launch ec2 instance , login through ssh. had accidentally deleted deafaul vpc , hence creating vpc scratch this. have created vpc 10.0.0.0/16 vpc cidr , 10.0.0.0/24 subnet , created gateway. have modified routing table this.

10.0.0.0/16 local

0.0.0.0/0 igw-xxxx

i have picked ubuntu ami , launched in vpc , assigned elastic ip instance.

i have public ip assigned instance , security group has port 22 open well. able ping public ip when try ssh ec2 instance with

ssh -i access.pem ubuntu@public.ip 

my connection times out, missing in configuration ?

recently, have played such configuration. below notes (this worked me), check if didn't miss something. looks wrong security group if can ping instance ip, can't connect via ssh. check different ami.

create vpc

$ vpcid=`aws ec2 create-vpc --cidr-block 10.0.0.0/24 --query 'vpc.vpcid' --output text` $$ echo $vpcid vpc-xxxxxxxx 

enable dns resolution within vpc

$ aws ec2 modify-vpc-attribute --vpc-id $vpcid --enable-dns-support "{\"value\":true}" $ aws ec2 modify-vpc-attribute --vpc-id $vpcid --enable-dns-hostnames "{\"value\":true}" 

create default gateway created vpc

$ internetgatewayid=`aws ec2 create-internet-gateway --query 'internetgateway.internetgatewayid' --output text` && echo $internetgatewayid igw-yyyyyyy $ aws ec2 attach-internet-gateway --internet-gateway-id $internetgatewayid --vpc-id $vpcid 

create subnet in vpc

$ subnetid=`aws ec2 create-subnet --vpc-id $vpcid --cidr-block 10.0.0.0/24 --query 'subnet.subnetid' --output text` && echo $subnetid subnet-zzzzzzz 

configure routing table

$ routetableid=`aws ec2 create-route-table --vpc-id $vpcid --query 'routetable.routetableid' --output text` && echo $routetableid  $ aws ec2 associate-route-table --route-table-id $routetableid --subnet-id $subnetid  $ aws ec2 create-route --route-table-id $routetableid --destination-cidr-block 0.0.0.0/0 --gateway-id $internetgatewayid 

create security group , open port 22 connection

$ securitygroupid=`aws ec2 create-security-group --group-name ec2-dev-secgroup --description "security group" --vpc-id $vpcid --query 'groupid' --output text` && echo $securitygroupid sg-xyzyzyz  $ aws ec2 authorize-security-group-ingress --group-id $securitygroupid --protocol tcp --port 22 --cidr 0.0.0.0/0 

create ssh keys

aws ec2 create-key-pair --key-name ec2-dev --query 'keymaterial' --output text > ~/.ssh/ec2-dev.pem  chmod 400 ~/.ssh/ec2-dev.pem 

create ec2 instance

$ instanceid=`aws ec2 run-instances --image-id ami-ecd5e884 --count 1 --instance-type t2.micro --key-name ec2-dev --security-group-ids $securitygroupid --subnet-id $subnetid --associate-public-ip-address --query 'instances[0].instanceid' --output text`  ssh -i .ssh/ec2-dev.pem ec2-user@52.x.y.z 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -