aws-cloudformation-templates
aws-cloudformation-templates copied to clipboard
SSH to EC2 in private vpc?
I would love to ssh to EC2 but there is no luck.
I am using ECS templates (private-vpc.yml + public-service.yml), in which the EC2 instance is not assigned a public ip address. In private-vpc.yml, there is a parameter KeyName, which indicates the key to access ec2. This also indicates ssh is doable? My question is how? If not, might be just delete this?
I also tried to associate an elastic ip to EC2 instance but still no luck. Would love some advice. Thanks.
Hello haoyanglu, You cannot ssh directly into a private instance from your local machine. You can however connect to a private instance through a public instance in a public subnet. (The private instance's security group should allow connections from the SG(security group) of the public instances). To do this, you first ssh into the public instance and then ssh from the public instance to the private instance. Local---->Public---->Private
This isn't really the right forum for this, but for the record it can now be done using an EC2 Instance Connect endpoint.
Due to inactivity this issue will be closed in 7 days