How Do You Run an AWS CLI Command to Allow Access to an EC-2 Instance in Security Group?

Problem Scenario
You want to modify a security group to allow SSH connections from an IP address. How do you do this with the AWS CLI?

You have to know the security group's ID. Replace "sg-abcd1234" with the group ID, and replace with the IP address and subnet mask you want to allow to connect from in this command and then run it:

aws ec2 authorize-security-group-ingress \
--group-id sg-abcd1234 \
--protocol tcp \
--port 22 \

Leave a comment

Your email address will not be published. Required fields are marked *