-
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
(ec2): VPC flow log ECS record fields don't work #33341
Comments
Currently to create Flow logs that support version 7 fields (ECS metadata) with the correct permissions you would have to use the FlowLogs construct similar to the following
Note: For demonstration purposes I have modified the role that is auto created by the FlowLogs construct, but probably would be better to use your own custom role In present day LogFormat is essentially just static strings so any permissions granting from the FlowLogs construct itself would have to happen within the constructor most likely around aws-cdk/packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts Lines 880 to 884 in 0c04e06
The permissions for I think the part that would be hard to incorporate into the existing FlowLogs construct is the scoping of the resource element for permissions such as The other thing to think about is the mapping of |
Thanks for the write up.
|
Thank you for the report @isker . Can you share a minimal code snippet as well as what permissions you expect to be auto generated? Meanwhile, we welcome PRs from the community. |
The policy @jacklin213 sketched above looks good, though implementation would get a lot easier if we did not need to scope grants to particular resources (i.e. we use wildcard for everything). |
Describe the feature
VPC flow logs support various ECS fields if one of the participants in the log record is an ECS task.
https://docs.aws.amazon.com/vpc/latest/userguide/flow-log-records.html
The documentation for each of these fields says:
Where the exact permission varies. I'm guessing "you" means the flow logs service principal
vpc-flow-logs.amazonaws.com
, though I'm honestly not certain. Regardless, CDK generates no such grants, so these ECS fields are always empty even when ECS is involved in the flow.Use Case
I want to investigate NAT gateway usage by ECS tasks. Without these records working, I have to correlate task ENI IP addresses to those appearing in the flow logs.
Proposed Solution
If any of the ECS LogFormats are used, FlowLog should grant the appropriate permissions.
Other Information
No response
Acknowledgements
CDK version used
2.178.1
Environment details (OS name and version, etc.)
N/A
The text was updated successfully, but these errors were encountered: