Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
[44;97;1m π€ Plandex [0;0;22m π Update security group configuration to allow inbound traffic on both port 80 and port 443 βοΈ Edits: β’ infra/src/main.ts β Allow inbound HTTP traffic on port 80 for the redirect to work
Dane Schneiderf7a5df4dc099
diff --git a/infra/src/main.ts b/infra/src/main.tsindex 82e81a64..b49a0701 100644--- a/infra/src/main.ts+++ b/infra/src/main.ts@@ -16,6 +16,7 @@ import * as cloudwatchActions from "@aws-cdk/aws-cloudwatch-actions";const tag = process.env.STACK_TAG;const notifyEmail = process.env.NOTIFY_EMAIL;const notifySms = process.env.NOTIFY_SMS;+const certificateArn = process.env.CERTIFICATE_ARN;export class PlandexStack extends cdk.Stack {constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {@@ -26,6 +27,9 @@ export class PlandexStack extends cdk.Stack {if (!notifySms) {throw new Error("NOTIFY_SMS environment variable is not set");}+ if (!certificateArn) {+ throw new Error("CERTIFICATE_ARN environment variable is not set");+ }super(scope, id, props);@@ -67,10 +71,10 @@ export class PlandexStack extends cdk.Stack {`plandex-rds-instance-${tag}`,{engine: rds.DatabaseInstanceEngine.postgres({- version: rds.PostgresEngineVersion.VER_14_2,+ version: rds.PostgresEngineVersion.VER_14,}),instanceType: ec2.InstanceType.of(- ec2.InstanceClass.BURSTABLE2,+ ec2.InstanceClass.BURSTABLE4_GRAVITON,ec2.InstanceSize.MICRO),vpc,@@ -162,13 +166,6 @@ export class PlandexStack extends cdk.Stack {});- console.log(- "dbInstance.dbInstanceEndpointPort: ",- dbInstance.dbInstanceEndpointPort- );- const dbPort = parseInt(dbInstance.dbInstanceEndpointPort);- console.log("dbPort: ", dbPort);-// Define the ingress rule for the security group to allow the Fargate service to communicate with the RDS instancefargateServiceSecurityGroup.addIngressRule(ec2.Peer.anyIpv4(),@@ -225,21 +222,10 @@ export class PlandexStack extends cdk.Stack {const certificate = acm.Certificate.fromCertificateArn(this,"Certificate",- "arn:aws:acm:region:account-id:certificate/certificate-id"+ certificateArn);- const listener = alb.addListener("plandexListener", {- port: 443,- certificates: [certificate],- });-- // Add a target group for the ECS service- const targetGroup = listener.addTargets("plandexEcsTarget", {- port: 8080,- targets: [fargateService],- });-- // Adjust the security group for the ALB to allow inbound traffic+ // Create an HTTP listener and add a redirect to HTTPSconst httpListener = alb.addListener("HttpListener", {port: 80,open: true,@@ -256,7 +242,9 @@ export class PlandexStack extends cdk.Stack {// Create an HTTPS listenerconst httpsListener = alb.addListener("HttpsListener", {port: 443,- certificates: [certificate],+ certificates: [+ acm.Certificate.fromCertificateArn(this, "Certificate", certificateArn),+ ],});// Add a target group for the ECS service to the HTTPS listener@@ -265,6 +253,8 @@ export class PlandexStack extends cdk.Stack {targets: [fargateService],});+ alb.connections.allowFromAnyIpv4(ec2.Port.tcp(80), "Allow inbound HTTP traffic");+alb.connections.allowFromAnyIpv4(ec2.Port.tcp(443),"Allow inbound HTTPS traffic"