- Newest
- Most votes
- Most comments
Hello Esource,
As security groups are stateful, as such you only need to allow traffic on port 22 in the ingress rules (Not the egress rules as you have mentioned above.) Could you please try making a rule allowing traffic inbound from your IP address specifically on port 22 again?
Because security groups are stateful the return traffic from the EC2 instance will automatically be allowed to be sent back to the source. In this case, the source being your laptop/ desktop where your SSH client is.
The documentation explaining this can be found here: Control traffic to EC2 instances with security groups - Security group basics - https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html#VPCSecurityGroups
Thank you Jasper. I updated the original question to clarify egress and ingress rules. I added egress to SG2 troubleshooting the situation.
Just want to clarify - the issue is not resolved at this time.
Two things to look at:
First, you say that the connection is rejected because the PEM isn't provided - that's pretty fatal; I'm not sure if that is related to your problem at all but definitely something to fix.
Second (and more important): You talk to creating egress rules for SSH. To reach your instance you need ingress rules.
this is what i get for rushing with the post. My mistake.
- PEM - the comment is to indicate that there is a connectivity to the vm.
- Egress: ingress and egress rules were added. SG2: Ingress for 22 from my IP and egress to SG1. in SG1 : ingress on 22 from SG2 and egress to 0.0.0.0 and SG2.
I'll update the original question to eliminate confusion.
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 8 months ago
This is still a bit confusing. Is SG2 created in step 6 applied to the EC instance created in step 1?. In Step 8 are you removing the port 22 rule, the ICMP rule, or both?