Created
October 27, 2025 04:39
-
-
Save alisade/d7fdc98d2e80516cabfbdbec10aa658e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Enable GuardDuty delegated admin | |
| if (enableGuardDuty) { | |
| const guardDutyPolicy = cr.AwsCustomResourcePolicy.fromStatements([ | |
| // from https://docs.aws.amazon.com/guardduty/latest/ug/organizations_permissions.html | |
| new iam.PolicyStatement({ | |
| actions: [ | |
| 'guardduty:EnableOrganizationAdminAccount', | |
| 'guardduty:ListOrganizationAdminAccounts', | |
| 'guardduty:DisableOrganizationAdminAccount', | |
| ], | |
| resources: ['*'], | |
| }), | |
| new iam.PolicyStatement({ | |
| actions: [ | |
| 'organizations:EnableAWSServiceAccess', | |
| 'organizations:RegisterDelegatedAdministrator', | |
| // ****************************************************************** | |
| // * not in AWS documentation, but is needed o.w. deployment will fail | |
| 'organizations:DeregisterDelegatedAdministrator', | |
| // ****************************************************************** | |
| 'organizations:ListDelegatedAdministrators', | |
| 'organizations:ListAWSServiceAccessForOrganization', | |
| 'organizations:DescribeOrganizationalUnit', | |
| 'organizations:DescribeAccount', | |
| 'organizations:DescribeOrganization', | |
| 'organizations:ListAccounts', | |
| ], | |
| resources: ['*'], | |
| }), | |
| new iam.PolicyStatement({ | |
| actions: ['iam:CreateServiceLinkedRole'], | |
| resources: ['*'], | |
| conditions: { | |
| StringEquals: { | |
| 'iam:AWSServiceName': 'guardduty.amazonaws.com', | |
| }, | |
| }, | |
| }), | |
| ]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment