Please tell me how to make the aws policy.

Asked 2 years ago, Updated 2 years ago, 64 views

{
  "Version": "2012-10-11",
  "Id": "Policy 1503119012324",
  "Statement": [{
    "Sid": "Stmt15031190096534",
    "Effect": "Deny",
    "Principal": "*",
    "Action": "*",
    "Resource": "arn:aws:s3::mybucket/*",
    "Condition": {
      I want to make an exception to certain IAM users here
    }
  }]
}

aws amazon-s3

2022-09-30 19:55

1 Answers

You can use NotPrincipal to specify the IAM user's ARN.
The ARN is in the format "arn:aws:iam::AWS account ID:user/IAM username".

{
  "Id": "Policy 3 IamUserAccessControl",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "mybucket01",
      "Action": "s3:*",
      "Effect": "Deny",
      "Resource": ["arn:aws:s3::mybucket",
      "NotPrincipal": {
        "AWS": [
          "arn:aws:iam::123456789012:user/take88" <- Exception IAM User
        ]
      }
    }
  ]
}


2022-09-30 19:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.