thankful-judge-75045
01/13/2023, 2:21 PMconst webTargetGroup = new aws.lb.TargetGroup(`web-target-${stack}`, {
port: 3000,
protocol: "HTTP",
vpcId: vpc.vpcId,
targetType: "ip",
});
const loadbalancer = new awsx.lb.ApplicationLoadBalancer(
`loadbalancer-${stack}`,
{
listeners: [
{
port: 3000,
protocol: "HTTP",
defaultActions: [
{
type: "redirect",
redirect: {
protocol: "HTTPS",
port: "443",
statusCode: "HTTP_301",
},
},
],
tags: {
Environment: stack,
},
},
{
port: 443,
certificateArn: apiCert.arn,
protocol: "HTTPS",
sslPolicy: "ELBSecurityPolicy-2016-08",
defaultActions: [
{
type: "forward",
forward: {
targetGroups: [
{
arn: webTargetGroup.arn,
},
],
},
},
],
tags: {
Environment: stack,
},
},
],
tags: {
Environment: stack,
},
}
);
I am also creating a Farget service using the code below
const webTargetGroup = stackRef.getOutput('webApplicationTargetGroup');
const image = new awsx.ecr.Image(`image-${stack}`, {
repositoryUrl: repoUrl,
path: '../',
});
new awsx.ecs.FargateService(`service-${stack}`, {
cluster: clusterArn,
assignPublicIp: true,
taskDefinitionArgs: {
container: {
image: image.imageUri,
cpu: cpu,
memory: memory,
essential: true,
portMappings: [
{
containerPort: containerPort,
targetGroup: webTargetGroup,
},
],
},
},
});
I am getting a 503 error after deployment. I believe its due to some port mapping configuration that I have excluded or entered incorrectly. My backend is running on port 3000. Any help is appreciated