1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
the 'missing region' error typically means that the AWS SDK can't discover a region to use when sending requests to AWS.
For Fargate tasks, the AWS SDK can do this automatically because Fargate injects the region into the environment variables of your task.
For EC2 tasks, you will need to instruct your tasks with AWS_REGION
so that the AWS SDK knows where your tasks are running.
Just add AWS_REGION
environment variable as per your location in the environment section of your container definition (in taskImageOptions
):
const taskImageOptions: ecsPatterns.ApplicationLoadBalancedTaskImageOptions = { family: `${this.appPrefix}-transform-task-ec2`, image: this.rustImageArm, containerPort: CONTAINER_PORT, environment: { AWS_REGION: '<your-region>', // e.g., us-west-2 }, logDriver: this.logDriver, command: ['./transform'], };
Remember to replace '<your-region>'
with the AWS region where your ECS service is running.
If you don't want to hardcode the region, you can also use CDK's Stack.region
attribute:
environment: { AWS_REGION: Stack.of(this).region, }
répondu il y a 2 mois
Contenus pertinents
- demandé il y a 2 mois
- demandé il y a 6 mois
- demandé il y a un an
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 5 ans