Restrict EC2 security group ingress on SSH (22) and RDP (3389) to trusted CIDRs#39
Draft
pagarwal-dev with Copilot wants to merge 2 commits into
Draft
Restrict EC2 security group ingress on SSH (22) and RDP (3389) to trusted CIDRs#39pagarwal-dev with Copilot wants to merge 2 commits into
pagarwal-dev with Copilot wants to merge 2 commits into
Conversation
…orts Co-authored-by: pagarwal-dev <224537592+pagarwal-dev@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unrestricted access on high-risk ports in security groups
Restrict EC2 security group ingress on SSH (22) and RDP (3389) to trusted CIDRs
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security group
sg-064d2f895824a22f1(us-east-2) had unrestricted ingress (0.0.0.0/0) on SSH and RDP, exposing instances directly to the internet.Changes
infra/security_group.tf— Definesaws_security_group.authentication_servicewith SSH (22) and RDP (3389) ingress scoped tovar.trusted_admin_cidrinstead of0.0.0.0/0/::/0. Each rule includes adescription; resource tagged withOwner,Purpose, andManagedBy.infra/variables.tf— Declarestrusted_admin_cidr(list(string), no default — forces explicit supply of approved CIDRs at deploy time) andvpc_id.The absence of a default on
trusted_admin_cidrensures no deployment can accidentally reintroduce an open CIDR.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.