Skip to content

Commit fff1043

Browse files
committed
Fixes for Lambda/k8s-connection
1 parent 06f3964 commit fff1043

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

infrastructure/cdk/src/main/java/com/unicorn/core/InfrastructureLambdaBedrock.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,25 @@ public InfrastructureLambdaBedrock(Construct scope, String id, String region, Bu
3333
.allowAllOutbound(true)
3434
.build();
3535

36+
ISecurityGroup clusterSG = eksCluster.getClusterSecurityGroup();
37+
3638
// Allow Lambda to communicate with EKS API server
3739
// The Kubernetes API typically runs on port 443 (HTTPS)
38-
eksCluster.getClusterSecurityGroup().addIngressRule(
40+
clusterSG.addIngressRule(
3941
Peer.securityGroupId(lambdaSg.getSecurityGroupId()),
4042
Port.tcp(443),
4143
"Allow Lambda access to Kubernetes API"
4244
);
4345

4446
// Allow Lambda to reach EKS cluster
4547
lambdaSg.addEgressRule(
46-
Peer.securityGroupId(eksCluster.getClusterSecurityGroup().getSecurityGroupId()),
48+
Peer.securityGroupId(clusterSG.getSecurityGroupId()),
4749
Port.tcp(443),
4850
"Allow Lambda to reach Kubernetes API"
4951
);
5052

5153
// Allow EKS cluster to respond back to Lambda
52-
eksCluster.getClusterSecurityGroup().addIngressRule(
54+
clusterSG.addIngressRule(
5355
Peer.securityGroupId(lambdaSg.getSecurityGroupId()),
5456
Port.tcp(443),
5557
"Allow Lambda access to Kubernetes API"

0 commit comments

Comments
 (0)