I've spend my whole evening on this. guess it is just I missed a stupid step. Here is the procedure I followed:
- create an aws vpc 10.0.0.0/24;
- create an aws internet gateway and associate it with the VPC;
- create a subnet in the VPC 10.0.0.0/26;
- Add inbound rule to VPC ACL to allow SSH, HTTP, HTTPS from all IPV4 sources;
- Launch aws ec2 instance with Amazon Linux 2 AMI in region us-west-2, t2.micro, instance details: Number of instances: 1 network: VPC created above subnet: subnet created above auto-assign Public IP: use subnet setting(Disable) Capacity reservation: Open everything else as default storage details add on data volume, delete on termination check security group: new security group with inbound rules ssh/http/https opened for all ipv4 sources use existing key pair I created earlier;
- create an elastic IP;
- associate the elastic IP to the instance created above.
- reboot the instance
Then I can see the instance is running well with elastic IP attached.
I tried to connect to the ip address with ssh ssh -vvv -i ./aws_private.pem ec2-user@ipaddress
and got below failure
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug2: resolve_canonicalize: hostname <elastic ipaddress> is address
debug2: ssh_connect_direct
debug1: Connecting to <elastic ipaddress> [<elastic ipaddress>] port 22.
debug1: connect to address <elastic ipaddress> port 22: Operation timed out
ssh: connect to host <elastic ipaddress> port 22: Operation timed out
I verified the ACL and Security group. Those are my only ACL and Security Group.
I'm using a Mac. And also tried with a windows OS as well as aws cloud shell in the same region. All of them have the same error.
telnet <elastic ip> 22
fails as well.
what did I do wrong?