Set boundary cho AWS permission set
Ngoài việc sử dụng SCP, thì cũng có thể sử dụng 1 policy để attach cho permission set làm boundary.
Lưu ý:
Để attach được boundary thì policy làm boundary phải tồn tại trên tài khoản được assign
Tên của boundary được set trong IAM Identity Center phải giống với tên của policy làm boundary
Permission boundary tham khảo:
Tôi có poc user, cho quyền admin, nay tôi muốn giới hạn lại, đặc biệt không cho untag, chỉnh sửa tag và thực hiện 1 số hành động nhạy cảm: tôi sẽ tạo 1 policy tên là ps-admin-boundary với nội dung như sau:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyLogsDeletion",
"Effect": "Deny",
"Action": [
"logs:Delete*"
],
"Resource": "*"
},
{
"Sid": "AllowSpecificServices",
"Effect": "Allow",
"Action": [
"ec2:*",
"rds:*",
"lambda:*",
"cloudwatch:*",
"cloudfront:*",
"elasticloadbalancing:*",
"autoscaling:*",
"dynamodb:*",
"sns:*",
"sqs:*",
"route53:*",
"apigateway:*",
"logs:*",
"kinesis:*",
"iam:Get*",
"iam:List*",
"iam:PassRole",
"bedrock:*"
],
"Resource": "*"
},
{
"Sid": "AllowEventBridge",
"Effect": "Allow",
"Action": [
"events:PutRule",
"events:PutTargets",
"events:RemoveTargets",
"events:EnableRule",
"events:DisableRule",
"events:DescribeRule",
"events:ListRules",
"events:ListTargetsByRule",
"events:TagResource",
"events:ListTagsForResource",
"events:TestEventPattern",
"events:PutEvents",
"events:StartReplay",
"events:ListReplays",
"events:DescribeReplay"
],
"Resource": "*"
},
{
"Sid": "DenyEventBridgeDeletions",
"Effect": "Deny",
"Action": [
"events:DeleteRule",
"events:UntagResource",
"events:RemovePermission"
],
"Resource": "*"
},
{
"Sid": "AllowResourceExplorer",
"Effect": "Allow",
"Action": [
"resource-explorer-2:Get*",
"resource-explorer-2:List*",
"resource-explorer-2:Search",
"resource-explorer-2:BatchGetView"
],
"Resource": "*"
},
{
"Sid": "DenyResourceExplorerViewManagement",
"Effect": "Deny",
"Action": [
"resource-explorer-2:CreateView",
"resource-explorer-2:DeleteView",
"resource-explorer-2:UpdateView"
],
"Resource": "*"
},
{
"Sid": "AllowResourceGroups",
"Effect": "Allow",
"Action": [
"resource-groups:*",
"tag:GetResources",
"tag:GetTagKeys",
"tag:GetTagValues",
"tag:TagResources"
],
"Resource": "*"
},
{
"Sid": "AllowServiceCatalog",
"Effect": "Allow",
"Action": [
"servicecatalog:SearchProducts",
"servicecatalog:DescribeProduct",
"servicecatalog:ListLaunchPaths",
"servicecatalog:DescribeProvisioningParameters",
"servicecatalog:ProvisionProduct",
"servicecatalog:UpdateProvisionedProduct",
"servicecatalog:TerminateProvisionedProduct",
"servicecatalog:DescribeProvisionedProduct",
"servicecatalog:DescribeRecord",
"servicecatalog:ListRecordHistory",
"servicecatalog:ListApplications",
"servicecatalog:CreateApplication",
"servicecatalog:UpdateApplication",
"servicecatalog:GetApplication",
"servicecatalog:AssociateResource",
"servicecatalog:DisassociateResource",
"servicecatalog:TagResource",
"servicecatalog:ListAssociatedResources"
],
"Resource": "*"
},
{
"Sid": "DenyServiceCatalogDeletions",
"Effect": "Deny",
"Action": [
"servicecatalog:DeleteApplication",
"servicecatalog:UntagResource",
"servicecatalog:UpdateTagOption"
],
"Resource": "*"
},
{
"Sid": "AllowKMSReadOnly",
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:DescribeKey",
"kms:Encrypt",
"kms:GenerateDataKey",
"kms:GenerateDataKeyWithoutPlaintext",
"kms:List*",
"kms:Get*"
],
"Resource": "*"
},
{
"Sid": "DenyKMSManagement",
"Effect": "Deny",
"Action": [
"kms:Create*",
"kms:Delete*",
"kms:Enable*",
"kms:Disable*",
"kms:Put*",
"kms:Update*",
"kms:Schedule*",
"kms:Revoke*",
"kms:Cancel*"
],
"Resource": "*"
},
{
"Sid": "AllowSageMaker",
"Effect": "Allow",
"Action": "sagemaker:*",
"Resource": [
"arn:aws:sagemaker:*:*:*",
"arn:aws:sagemaker:*:aws:hub/*"
]
},
{
"Sid": "AllowDataManagementServices",
"Effect": "Allow",
"Action": [
"datazone:*",
"glue:*",
"lakeformation:*",
"athena:*"
],
"Resource": "*"
},
{
"Sid": "AllowBillingAndCostViewOnly",
"Effect": "Allow",
"Action": [
"ce:Get*",
"ce:List*",
"ce:Describe*",
"aws-portal:ViewBilling",
"aws-portal:ViewUsage",
"account:GetAccountInformation",
"pricing:Get*",
"pricing:List*",
"pricing:Describe*",
"savingsplans:Describe*",
"cur:Get*",
"cur:Describe*",
"budgets:View*",
"budgets:Describe*"
],
"Resource": "*"
},
{
"Sid": "AllowIAMRoleAndPolicyManagement",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:UpdateRole",
"iam:CreatePolicy",
"iam:CreatePolicyVersion",
"iam:SetDefaultPolicyVersion",
"iam:AttachRolePolicy",
"iam:PutRolePolicy",
"iam:DeleteRolePolicy",
"iam:TagRole",
"iam:UntagRole",
"iam:TagPolicy",
"iam:UntagPolicy"
],
"Resource": "*"
},
{
"Sid": "AllowS3WithRestrictions",
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*",
"s3:Put*",
"s3:CreateBucket",
"s3:RestoreObject",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts",
"s3:ListBucketVersions",
"s3:GetBucketVersioning",
"s3:PutBucketVersioning",
"s3:GetBucketAcl",
"s3:PutBucketAcl",
"s3:GetObjectAcl",
"s3:PutObjectAcl",
"s3:GetBucketCORS",
"s3:PutBucketCORS",
"s3:GetBucketWebsite",
"s3:PutBucketWebsite",
"s3:GetBucketNotification",
"s3:PutBucketNotification",
"s3:GetBucketLogging",
"s3:PutBucketLogging"
],
"Resource": "*"
},
{
"Sid": "DenyS3Deletions",
"Effect": "Deny",
"Action": [
"s3:Delete*"
],
"Resource": "*"
},
{
"Sid": "DenyIAMUserAndKeyManagement",
"Effect": "Deny",
"Action": [
"iam:CreateUser",
"iam:DeleteUser",
"iam:CreateAccessKey",
"iam:DeleteAccessKey",
"iam:UpdateAccessKey",
"iam:GetAccessKeyLastUsed",
"iam:CreateLoginProfile",
"iam:DeleteLoginProfile",
"iam:CreateVirtualMFADevice",
"iam:DeleteVirtualMFADevice",
"iam:DeactivateMFADevice",
"iam:CreateServiceSpecificCredential",
"iam:UpdateServiceSpecificCredential",
"iam:DeleteServiceSpecificCredential",
"iam:ResetServiceSpecificCredential",
"iam:ListServiceSpecificCredentials",
"iam:ListAccessKeys"
],
"Resource": "*"
},
{
"Sid": "DenyMarketplaceActions",
"Effect": "Deny",
"Action": [
"aws-marketplace:Subscribe",
"aws-marketplace:Unsubscribe",
"aws-marketplace:AssociateProductsWithPrivateMarketplace",
"aws-marketplace:DisassociateProductsFromPrivateMarketplace"
],
"Resource": "*"
},
{
"Sid": "DenyPolicyDelete",
"Effect": "Deny",
"Action": [
"iam:DeletePolicy",
"iam:DeleteRole"
],
"Resource": "arn:aws:iam::*:policy/*"
},
{
"Sid": "DenyBoundaryPolicyModification",
"Effect": "Deny",
"Action": [
"iam:CreatePolicyVersion",
"iam:DeletePolicyVersion",
"iam:SetDefaultPolicyVersion",
"iam:DeletePolicy"
],
"Resource": "arn:aws:iam::301664410103:policy/*boundary*"
},
{
"Sid": "DenyUntagActions",
"Effect": "Deny",
"Action": [
"ec2:DeleteTags",
"rds:RemoveTagsFromResource",
"lambda:UntagResource",
"dynamodb:UntagResource",
"sagemaker:DeleteTags",
"s3:DeleteObjectTagging",
"glue:UntagResource",
"athena:UntagResource",
"kinesis:RemoveTagsFromStream",
"sns:UntagResource",
"sqs:UntagQueue",
"cloudfront:UntagResource",
"elasticloadbalancing:RemoveTags",
"autoscaling:DeleteTags",
"bedrock:UntagResource"
],
"Resource": "*"
},
{
"Sid": "AllowViewOnlyIAM",
"Effect": "Allow",
"Action": [
"iam:Get*",
"iam:List*",
"iam:Generate*"
],
"Resource": "*"
}
]
}
Những điểm mà policy này làm được:
- Bảo vệ Resources:
✅ Chặn xóa logs, S3 resources
✅ Chặn xóa EventBridge rules
✅ Chặn xóa Service Catalog applications
✅ Chặn untag cho tất cả services
✅ Chặn xóa IAM roles/policies
- Permissions cho:
✅ Service Catalog usage
✅ Resource Explorer (chỉ view)
✅ KMS (chỉ sử dụng, không quản lý)
✅ EventBridge (đủ quyền tạo và quản lý)
✅ Billing (chỉ view)
- Data & AI Services:
✅ Full access cho Bedrock
✅ Full access cho SageMaker
✅ Full access cho Data services (Glue, Athena, etc.)
- Core Services:
✅ Full access cho EC2, RDS, Lambda
✅ Full access cho networking services
✅ Đủ quyền IAM để tạo roles và policies
- Tagging Strategy:
✅ Cho phép gán tags
✅ Chặn untag trên mọi service
✅ Duy trì tính nhất quán của tags
Điểm cần lưu ý:
Cần quy trình riêng cho các trường hợp cần xóa resources hoặc untag, do không cho chặn xoá và untag, sửa tags 1 số resources.
Bạn có thể chỉnh sửa lại cho phù hợp với nhu cầu của bạn, nhưng lưu ý giời hạn của 1 IAM policy là 6144 characters limit nhé!
Ưu điểm của cách làm này là bạn có thể nhanh chóng customize lại permission set mà không cần tạo permission set mới, hay sửa SCP.