Replies: 1 comment
-
As a quick follow-up, I tried using the TypeScript version of the CDK, following the example outlined in a previous discussion (#22386), to see if the underlying issue might be related to the language used, or to the private ECR Repo issue. Here's the TypeScript code I ended up using, which copies the solution the original poster found for the issue: import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as ecsp from '@aws-cdk/aws-ecs-patterns';
import { Repository, EcrImage } from '@aws-cdk/aws-ecr';
export class MyPythonTestBackendService extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const vpc = ec2.Vpc.fromLookup(this, 'VPC', {
isDefault: true,
});
const cluster = new ecs.Cluster(this, 'MyCluster', {
vpc: vpc,
});
const repo = Repository.fromRepositoryArn(this, "PythonTestRepository", REPOSITORY_NAME);
const myEcrImage = EcrImage.fromEcrRepository(repo, 'latest');
new ecsp.ApplicationLoadBalancedFargateService(this, 'PythonTestService', {
cluster: cluster,
assignPublicIp: true,
desiredCount: 2,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
image: myEcrImage,
containerName: 'PythonTestContainer',
containerPort: 5000,
enableLogging: true,
},
taskSubnets: {
subnetType: ec2.SubnetType.PUBLIC,
},
});
}
} Unfortunately, I encountered the exact same issue here, with the ECS service not completing the deployment process. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I'm facing a challenge deploying a simple Python Flask application using the
aws_ecs_patterns.ApplicationLoadBalancedFargateService
construct in AWS CDK. Regardless of the configurations I try, the deployment process consistently stalls during the final steps, and the stack never finishes deploying.Previously, I encountered a similar issue with the AWS Solutions Constructs, but switching to the direct ECS patterns construct didn't resolve the problem.
Application Details
Here's the Flask application I'm trying to deploy:
Docker Configuration
I'm using this Dockerfile:
AWS CDK Stack Configuration
This is the CDK stack configuration:
Repository configuration:
Issue Details
The ECS service repeatedly enters the deployment phase but transitions to draining without ever stabilizing. I've checked the security groups, the health check configurations, and ensured that the container logs do not indicate any errors at runtime. The service appears to be unable to pass the ALB health checks consistently and I attempted both the default health endpoint as well as this custom one.
Any insights or suggestions would be immensely helpful as I've been stuck on this issue for a while now.
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions