@@ -58,10 +58,23 @@ resource "aws_route_table_association" "vectorstore_rta" {
58
58
59
59
60
60
61
+ # resource "aws_lb" "vectorstore_nlb" {
62
+ # name = "vectorstore-nlb"
63
+ # internal = true #INTERNAL NLB, ONLY ACCESSIBLE VIA VPC LINK
64
+ # load_balancer_type = "network"
65
+ # subnets = [aws_subnet.vectorstore_subnet.id]
66
+ # enable_deletion_protection = false
67
+
68
+ # tags = {
69
+ # Name = "vectorstore_nlb"
70
+ # }
71
+ # }
72
+
73
+
61
74
resource "aws_lb" "vectorstore_nlb" {
62
75
name = " vectorstore-nlb"
63
76
internal = true # INTERNAL NLB, ONLY ACCESSIBLE VIA VPC LINK
64
- load_balancer_type = " network "
77
+ load_balancer_type = " application "
65
78
subnets = [aws_subnet . vectorstore_subnet . id ]
66
79
enable_deletion_protection = false
67
80
@@ -70,6 +83,8 @@ resource "aws_lb" "vectorstore_nlb" {
70
83
}
71
84
}
72
85
86
+
87
+
73
88
# resource "aws_lb_target_group" "vectorstore_tg" {
74
89
# name = "vectorstore-tg"
75
90
# port = 19530
@@ -104,9 +119,10 @@ resource "aws_security_group" "nlb_sg" {
104
119
# }
105
120
106
121
# port for ECS fargate container API:
122
+ # 19531
107
123
ingress {
108
- from_port = 19531
109
- to_port = 19531
124
+ from_port = 80 # http traffic from ALB
125
+ to_port = 80
110
126
protocol = " tcp"
111
127
cidr_blocks = [" 0.0.0.0/0" ]
112
128
}
@@ -149,15 +165,15 @@ resource "aws_security_group" "milvus_sg_api" {
149
165
150
166
151
167
152
- # Modify your EC2 instance security group to only allow traffic from the NLB security group
153
- resource "aws_security_group_rule" "allow_nlb_to_ec2" {
154
- type = " ingress"
155
- from_port = 19530
156
- to_port = 19530
157
- protocol = " tcp"
158
- security_group_id = aws_security_group. milvus_sg_api . id
159
- source_security_group_id = aws_security_group. nlb_sg . id
160
- }
168
+ # # Modify your EC2 instance security group to only allow traffic from the NLB security group
169
+ # resource "aws_security_group_rule" "allow_nlb_to_ec2" {
170
+ # type = "ingress"
171
+ # from_port = 19530
172
+ # to_port = 19530
173
+ # protocol = "tcp"
174
+ # security_group_id = aws_security_group.milvus_sg_api.id
175
+ # source_security_group_id = aws_security_group.nlb_sg.id
176
+ # }
161
177
162
178
resource "aws_instance" "milvus_instance" {
163
179
ami = var. ami
@@ -181,27 +197,6 @@ resource "aws_instance" "milvus_instance" {
181
197
}
182
198
183
199
184
- # resource "aws_instance" "milvus_instance" {
185
- # ami = var.ami
186
- # instance_type = var.instance_type
187
- # key_name = var.key_name
188
- # subnet_id = aws_subnet.vectorstore_subnet.id
189
- # vpc_security_group_ids = [aws_security_group.milvus_sg_api.id]
190
- # associate_public_ip_address = true // This line assigns a public IP address to your instance
191
-
192
- # user_data = file("${path.module}/../create-milvus.sh")
193
-
194
- # root_block_device {
195
- # volume_size = 30
196
- # }
197
-
198
- # tags = {
199
- # Name = "Milvus-db-for-api"
200
- # }
201
- # }
202
-
203
-
204
-
205
200
# create SSMRoleForEC2 that the EC2 instance needs to assume to connect via System Manager , instead of via SSH
206
201
207
202
resource "aws_iam_role" "ssm_role" {
0 commit comments