-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
What is the problem?
ECS supports cross-region logging with awslogs with the awslogs-region option.
When I pass a cross-region LogGroup (constructed from an arn), the awslogs-region option in the resulting template is always the current region, ignoring the log group's region.
Reproduction Steps
Create a cross-region log group and pass it to ecs.AwsLogDriver:
log_group = logs.LogGroup.from_log_group_arn(f"arn:aws:logs:eu-west-2:{self.account}:log-group:my_log_group")
container = ecs.ContainerDefinition(self, "container",
...
logging=ecs.AwsLogDriver(stream_prefix="my_prefix", log_group=log_group)
)What did you expect to happen?
The logs are written to the specified log group.
What actually happened?
The task execution role is given the correct permissions for the log group (including the correct region).
But the awslogs-region option in the container definition is always the same as the container's region.
Task fails to start.
CDK CLI Version
1.134
Framework Version
No response
Node.js Version
17.1.0
OS
Linux
Language
Typescript, Python, .NET, Java, Go
Language Version
No response
Other information
I'm resorting to escape hatches to override Properties.ContainerDefinitions.0.LogConfiguration.Options.awslogs-region on the task definition, but this doesn't work if there are multiple containers.