How do I allow access to an application on an EC2 instance with a security group?

2 minute read

I want to allow access to an application on my Amazon Elastic Compute Cloud (Amazon EC2) instance using security groups.


New security groups have only an outbound rule to allow traffic by default. Security groups associated with an Amazon EC2 instance control inbound and outbound traffic for the instance. You must add rules to security groups to allow inbound traffic or restrict outbound traffic with your Amazon Virtual Private Cloud (Amazon VPC).

For example, applications hosted on port 80 or 443 on the Amazon EC2 instance must allow users to connect with an inbound rule. For HTTP traffic, add an inbound rule on port 80 from the source address For HTTPS traffic, add an inbound rule on port 443 from the source address For more information, see Example inbound and outbound rules.

To create a new security group, see Create a security group. To add rules to a security group, see Add rules to a security group.

To assign a security group on an Amazon EC2 instance when you launch the instance, see Assign a security group to an instance.

To modify a security group after an instance is launched, see Change an instance's security group.

For more information, see Control traffic to your AWS resources using security groups.

Related information

Security group rules for different use cases

AWS OFFICIALUpdated 9 months ago