Skip to content

Commit 0ad60ab

Browse files
author
prashansa joshi
committed
Outbound sg to 3306
1 parent c5f0f1b commit 0ad60ab

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

terraform/alb.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module "alb" {
2929

3030
health_check = {
3131
enabled = true
32-
path = "/health"
32+
path = "/"
3333
protocol = "HTTPS" # Customize this based on your needs
3434
matcher = "200-299" # HTTP status codes that indicate a healthy response
3535
interval = 30 # Time in seconds between health checks

terraform/sg.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ resource "aws_security_group" "database" {
5353
cidr_blocks = ["0.0.0.0/0"]
5454
# cidr_blocks = local.vpc.vpc_cidr
5555
# security_groups = [aws_security_group.backend_asg.id]
56+
security_groups = [aws_security_group.eb_instances.id] # Restrict access to EB instances only
5657
}
5758

5859
egress {
@@ -63,3 +64,26 @@ resource "aws_security_group" "database" {
6364
}
6465
tags = module.naming.resources.rds.tags
6566
}
67+
68+
69+
70+
#################################################
71+
# EC2
72+
#################################################
73+
resource "aws_security_group" "eb_instances" {
74+
name = "eb-instances-sg"
75+
description = "Security group for Elastic Beanstalk instances"
76+
vpc_id = data.aws_vpc.adex_poc_default_vpc.id
77+
78+
# Allow outbound MySQL traffic to the RDS security group
79+
egress {
80+
from_port = 3306
81+
to_port = 3306
82+
protocol = "tcp"
83+
security_groups = [aws_security_group.database.id]
84+
}
85+
86+
tags = {
87+
Name = "EB Instances SG"
88+
}
89+
}

0 commit comments

Comments
 (0)