Created
December 15, 2023 18:15
-
-
Save moerv9/e09e2ebc39124205f8d4c09b3e0409cf to your computer and use it in GitHub Desktop.
Relayer service
This file contains 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
// export class RelayerServiceStack etc etc... | |
// and importing vpc and cluster above | |
const listener = props.relayerLoadBalancer.addListener("RelayerListener", { | |
port: 80, | |
protocol: elbv2.ApplicationProtocol.HTTP, | |
open: true, | |
}); | |
listener.connections.allowFromAnyIpv4(ec2.Port.allTraffic()); | |
const sg_service = new ec2.SecurityGroup(this, "RelayerSG", { | |
vpc: vpc, | |
allowAllOutbound: true, | |
description: "Security group for Relayer tasks", | |
}); | |
sg_service.addIngressRule( | |
ec2.Peer.ipv4("0.0.0.0/0"), | |
ec2.Port.allTraffic() | |
); | |
// Create a Fargate service | |
const relayerService = new ecs.FargateService(this, "RelayerServiceM", { | |
cluster: cluster, | |
taskDefinition: props.taskDefinition, | |
enableExecuteCommand: true, | |
securityGroups: [sg_service], | |
assignPublicIp: false, | |
healthCheckGracePeriod: Duration.seconds(3600), | |
}); | |
listener.addTargets("RelayerTarget", { | |
port: 80, | |
targets: [relayerService], | |
healthCheck: { | |
path: "/health", | |
healthyHttpCodes: "200-499", | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment