DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Unlocking the Benefits of a Private API in AWS API Gateway
  • AWS WAF Classic vs WAFV2: Features and Migration Considerations
  • Processing Cloud Data With DuckDB And AWS S3
  • AWS Nitro Enclaves: Enhancing Security With Isolated Compute Environments

Trending

  • Transforming AI-Driven Data Analytics with DeepSeek: A New Era of Intelligent Insights
  • How to Convert XLS to XLSX in Java
  • Microsoft Azure Synapse Analytics: Scaling Hurdles and Limitations
  • How to Configure and Customize the Go SDK for Azure Cosmos DB
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. 5 Best Practices for AWS Security Groups

5 Best Practices for AWS Security Groups

Want to learn more about these best practices for AWS Security Groups? Check out this post to learn more about AWS resources and how you can protect your data.

By 
Jayashree Hegde Adkoli user avatar
Jayashree Hegde Adkoli
·
Aug. 27, 18 · Opinion
Likes (5)
Comment
Save
Tweet
Share
29.5K Views

Join the DZone community and get the full member experience.

Join For Free

To secure AWS resources 24-7 from unwanted attacks, the right combination of VPC, Network Access Control Lists (NACLs), and Security Groups are a must. AWS Security Groups are cloud firewalls that help protect applications and data.

AWS Security Groups (SGs) restrict access to certain IP addresses or resources. It guards your AWS security perimeter, always, provided you configure them in the right way! Here are the five best practices you can never ignore while configuring AWS SGs.

#1: Ensure EC2 SGs Do Not Have Large Range of Ports Open

Large port ranges, when open, expose instances to unwanted attacks. More than that, they make traceability of vulnerabilities very difficult. For instance, your web servers may only require 80 and 443 ports to be open, but not all.

One of the most common mistakes we observe is when users open all ports for 0.0.0.0/0 range in a rush to access the instance and later forget to fix it!

When running on EC2 instances, you must expose your apps only to those ports enabled on the corresponding security group level.

#2: Use ELB's SGs Wisely to Restrict EC2s' Access to the Internet

Even though a web server's port 80 or 443 needs access to 0.0.0.0/0, it need not be open directly. Use an AWS ELB to receive all incoming traffic from the Internet and forward it to these web servers or EC2s, then allow these EC2s to intake incoming traffic from the ELB only. Lockdown ingress rules for these instances to the ELB SG. This way, no one will be able to reach the EC2s directly.

#3: Never Keep Unattached Security Groups and Limit Modifications to Only Certain Roles

Security configurations on AWS are dynamic. An administrator can change these configurations anytime. With the presence of unattached SGs, the risk of misconfiguration increases, because it makes it difficult for an administrator to figure out attached and unattached SGs in a large scale infrastructure. Chances of him/her changing the configurations of wrong SGs or accidentally attaching them to public instance becomes high, inadvertently opening up your environment to attacks.

Pro tip: The easiest way to identify unused security groups is to browse through security groups list, select ALL, and click Delete. AWS shows the list of attached SGs and prompts them to delete only unattached SGs. Once you hit Delete, only unattached SGs are removed. The best way is to use an automated program doing this as part of your regular audits.

Just like an administrator accidentally misconfiguring SGs, other IAM roles with access to modifying SGs can misconfigure them too. Authorize only specific users to modify resource-specific security groups.

Keep a constant eye on IAM policies with a check on instance metadata, network ACLs, and SGs together. Only selective users must be able to change only a particular security group in a given region so that they can update or modify as and when needed.

#4: Do Not Ignore Outbound Rules of SG; Set Restrictions Decisively

By default, an AWS SG does not have any ingress rules, and the outbound ports are open to the Internet. That emphasizes the fact that not only ingress rules need attention. However, egress rules need attention too. So, SGs attached to an application layer should only allow egress connections to the layer where it needs to connect. For instance, if the web layer is only authorized to initiate connections to the application layer, the egress rules should only point to application-specific ports and specific subnetworks (e.g., VPC, security groups).

#5: Track Rate of Change in SGs' Creation and its Ports Opening and Closing in Production

If an SG was created and its port was opened and closed in a very short duration of time, say less than 30 minutes, it typically is a case of suspicious activity, especially, if it is in the production environment. The best way forward is to parse the AWS Cloud Trail logs in the production environment, compare with usual patterns, and monitor the activities.

Conclusion: 


There are tons of other best practices for AWS Security Group, like avoiding opening SSH/RDP to other instances of the production environment. All these are very important, but the above list are the "must-dos." You can use tools like Puppet, Chef, RunDesk, etc. in conjunction with AWS to automate security audits. However, it's overwhelming to keep a track on all these tools on different dashboards.

Moreover, SGs alone do not help mitigate security risks. Like we said before, the right combination of VPC, NACLs, and SGs make up for the security of your infrastructure.

Having said that, multiple dashboards to monitor and manage all these resources will take the energy out of the team. A single visual console, likeTotalCloudrendering the relationship between all these resources will show all the port connections with ingress, and egress details help find vulnerabilities in a snap. TotalCloud is currently working on such a kind of Security View. 

To wrap-up, cloud computing has been here for more than two decades. Yet, several businesses find security as a challenge to tackle. In this age of cloud computing, why is cloud security more important than ever? Read this post here.

AWS security

Published at DZone with permission of Jayashree Hegde Adkoli, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Unlocking the Benefits of a Private API in AWS API Gateway
  • AWS WAF Classic vs WAFV2: Features and Migration Considerations
  • Processing Cloud Data With DuckDB And AWS S3
  • AWS Nitro Enclaves: Enhancing Security With Isolated Compute Environments

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!