Skip to content

AWS Organization policy to limit the AcceptDataGrant action only among aws org members accounts

0

Hello, I need to configure a policy to apply to aws organization accounts. Requirement 1: AcceptDataGrant action must be allowed only among accounts of the same organization and must be denied from accounts not part of the aws organization. Requirement 2: the aws organization payer account must be able to send/receive DataGrants to/from any aws account, regardless of being part of the organization or not

we tried a couple of options, shown below, without success

{ "Effect": "Deny", "Action": "dataexchange:AcceptDataGrant", "Resource": [ "*" ], "Condition": { "StringNotEquals": { "aws:ResourceOrgID": "PRINCIPALORGID" ] } } }

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": [ "dataexchange:AcceptDataGrant" ], "Resource": "*", "Condition": { "StringEquals": { "aws:PrincipalOrgID": "ORGID" }, "StringNotEquals": { "aws:PrincipalAccount": "ACCOUNTID" } } } ] }

1 Answer
1

To meet your requirements for controlling the AcceptDataGrant action within your AWS Organization, you'll need to create a Service Control Policy (SCP) that combines both allow and deny statements. Here's a policy that should achieve your goals:

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowAcceptDataGrantWithinOrg", "Effect": "Allow", "Action": "dataexchange:AcceptDataGrant", "Resource": "", "Condition": { "StringEquals": { "aws:PrincipalOrgID": "${aws:PrincipalOrgID}" } } }, { "Sid": "DenyAcceptDataGrantOutsideOrg", "Effect": "Deny", "Action": "dataexchange:AcceptDataGrant", "Resource": "", "Condition": { "StringNotEquals": { "aws:PrincipalOrgID": "${aws:PrincipalOrgID}" } } }, { "Sid": "AllowPayerAccountUnrestrictedAccess", "Effect": "Allow", "Action": "dataexchange:AcceptDataGrant", "Resource": "*", "Condition": { "StringEquals": { "aws:PrincipalAccount": "PAYER_ACCOUNT_ID" } } } ] }

This policy does the following:

  1. The first statement allows the AcceptDataGrant action only among accounts within the same organization.

  2. The second statement denies the AcceptDataGrant action for any account not part of the organization.

  3. The third statement allows unrestricted AcceptDataGrant action for the payer account.

Replace "PAYER_ACCOUNT_ID" with your actual AWS Organization payer account ID.

This SCP should be applied to the root of your organization or to the Organizational Units (OUs) containing the member accounts you want to restrict. The payer account, being the management account of the organization, is not affected by SCPs, so it will retain its ability to send/receive DataGrants to/from any AWS account.

Remember that SCPs don't grant permissions themselves; they set the maximum permissions for accounts in your organization. You'll still need to grant the necessary permissions to IAM users or roles within each account using identity-based policies.
Sources
Examples of Amazon S3 bucket policies - Amazon Simple Storage Service
SCP evaluation - AWS Organizations
Enforcing enterprise-wide preventive controls with AWS Organizations | AWS Cloud Operations Blog

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.