-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
step-functions: run ecs task when guard duty runtime monitoring is enabled #32877
Comments
When GuardDuty Runtime Monitoring is enabled for ECS Fargate tasks: [2]
Looking at your provided error
Looks like ecs task can't pull the guardduty sidebar container due to "failed to resolve"? Unfortunately we don't have immediately working sample and the document does not provide relevant details. As you mentioned this works for you.
I am guessing you probably are missing ECR permissions for this sidebar container image. I am not sure what is the best recommended permissions in your use case as the document is not having this info but I'll reach out internally and see if we can update the public documents. Some options you can consider here:
|
internal: V1642261665 |
According to the doc: You will need the following in your IAM policy.
FYR |
Hi @pahud Thank you very much for the provided help. I had searched the docs but was unable to find this. Maybe this should be included / abstracted away by the construct. Like a flag whether the task is monitored by GuardDuty or not. I added the permissions and in my case also scoped them to the guard duty ECR repo: this.taskDefinition.addToExecutionRolePolicy(
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
// @see https://docs.aws.amazon.com/guardduty/latest/ug/prereq-runtime-monitoring-ecs-support.html#before-enable-runtime-monitoring-ecs
actions: [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
],
// @see https://docs.aws.amazon.com/guardduty/latest/ug/runtime-monitoring-ecr-repository-gdu-agent.html
resources: ["arn:aws:ecr:eu-central-1:323658145986:repository/aws-guardduty-agent-fargate"],
}),
); |
Describe the bug
In our org we have Guard Duty runtime monitoring for ECS enabled.
When running a task inside a step function like this:
The task itself is run successfully, but the state still fails due to insufficient permissions regarding GuardDuty.
Please note that the guard duty agent is not configured in our ECS task, but it is added by AWS if guard duty is enabled.
We can work around this by adding wildcard permissions like this, but it's less than ideal
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
CDK should add the necessary permissions.
Current Behavior
Permissions are insufficient.
Reproduction Steps
It is not possible to create a self-contained example, as the error originates from account / org specific configuration.
In our org we have a landing zone with a dedicated security account and an developer account where the ECS task and the calling step function is placed.
Steps:
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.173.3
Framework Version
No response
Node.js Version
22
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: