I create a VPC, and try to connect to a EC2 by connecting to AWS Ubuntu.
But when I go to the page of connecting, it showed me this
The instance does not have a public IPv4 address
To connect using the EC2 Instance Connect browser-based client, the instance must have a public IPv4 address.
What I’ve tried
In EC2 Panel > Action > Networks > Manage IP Address > Ipv4 Addresses > Assign New IP Address(only available for priate IP Address, but I couldn’t do anything in section of pubilc IP Address)
3
Answers
Follow the AWS link instruction.
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-associate-static-public-ip/
Go to the EC2 dashboard, on the left panel, open
Network & Security -> Elastic IPs
Allocate an elastic IP, and click
Actions
dropdown. ClickAssociate Elastic IP address
.You can connect the elastic IP to your instance or Network interfaces of the instance.
First, do you mean Private Subnet?
Also ensure port 22 is open from correct ip. Private EC2 can’t be accessed from public internet.
To connect with EC2 in private subnet you need a bastion host & NAT gateway attached.
Refer this link for more info.