Create Security Group

Creating Security Groups in Amazon VPC

ℹ️ Overview

  • A security group is a virtual firewall for your AWS resources
  • It works like an access control list (ACL) at the instance level
  • It lets you control inbound and outbound traffic by port and protocol

🔒 Creating the Security Group for the Public Subnet

  1. Open the VPC console
    • Select Security Groups from the left-hand menu
    • Click Create security group

Create VPC

  1. Fill in the basic information
    • Security group name: Enter Public subnet - SG
    • Description: Enter Allow SSH and Ping for servers in public subnet
    • VPC: Select the ASG VPC

Create VPC

  1. Set up the inbound rules
    • Click Add rule
    • Rule 1:
      • Type: SSH
      • Source: Anywhere
    • Click Add rule again
    • Rule 2:
      • Type: All ICMP - IPv4
      • Source: Anywhere

🔒 Security Best Practice
Restricting ICMP to your VPC CIDR block prevents external ping sweeps while still allowing internal connectivity testing.

Create VPC

  1. Review the outbound rules and create the security group
    • By default, all outbound traffic is allowed
    • Click Create security group

Create VPC

  1. Check the security group you created
    • You’ll see a success message
    • The new security group appears in the list

Create VPC

🔒 Creating the Security Group for the Private Subnet

  1. Go back to the Security Groups screen
    • Click Create security group

Create VPC

  1. Fill in the basic information
    • Security group name: Enter Private subnet - SG
    • Description: Enter Allow SSH and Ping for servers in private subnet
    • VPC: Select the ASG VPC

Create VPC

  1. Set up the inbound rule for SSH

    • Click Add rule
    • Type: SSH
    • Source: Custom
    • Search for and select the Public subnet - SG security group (this allows SSH only from instances in the public subnet)
  2. Add the rule for ICMP

    • Click Add rule
    • Type: All ICMP - IPv4
    • Source: Anywhere

    Create VPC 🔒 Security Best Practice
    Restricting ICMP to the VPC CIDR ensures that only internal resources can run ping tests, reducing the attack surface while keeping troubleshooting capability.

  3. Finish creating the security group

    • Review the configuration
    • Click Create security group

Create VPC

Configuring the Security Group for VPC Endpoints

  1. Create an additional security group for VPC endpoints:
    • Go back to Security Groups
    • Click Create security group
    • Security group name: Enter VPC-Endpoints-SG
    • Description: Enter Security group for VPC endpoints
    • VPC: Select the ASG VPC from the dropdown

Create VPC Create VPC

  1. Configure the security group rules for the VPC Endpoints:
    • Inbound rules:
      • Click Add rule
      • Type: Select HTTPS
      • Source: Select Custom and enter 10.10.0.0/16 (VPC CIDR)
      • Description: Enter HTTPS access from VPC resources

Create VPC

  • Outbound rules: Keep the default (all traffic allowed)
  • Click Create security group

Create VPC

  1. Update the Private Subnet Security Group for VPC endpoint access:
    • Select Private subnet - SG
    • Click Actions > Edit outbound rules
    • Make sure the following outbound rule exists:
      • Type: HTTPS
      • Destination: 0.0.0.0/0
      • Description: HTTPS to AWS services and VPC endpoints
    • Click Save rules

Create VPC Create VPC

💡 Confirming the Configuration 14. Check the three security groups you created:

  • Public subnet - SG: allows SSH from your IP and ICMP from the VPC
  • Private subnet - SG: allows SSH from the public subnet and ICMP from the VPC
  • VPC-Endpoints-SG: allows HTTPS from the VPC to reach AWS services

Create VPC