Configuring AWS cloud credentials
Cloudera Cloud Factory provisions AWS resources through a DelegatedAdmin IAM role whose permission boundary lets it create only tagged resources and child roles capped by a child boundary, so it cannot escalate its own privileges.
The DelegatedAdmin role has the AWS managed AdministratorAccess policy attached and a permission boundary. The effective permissions of the role are the intersection of AdministratorAccess and the boundary, so Cloudera Cloud Factory can create roles without escalating its own privileges.
The boundary allows the role to create and manage resources only when they carry the tag ccf.cloudera.com/managed=true. The role can read resources that it did not create, but it can modify or delete only resources that carry the tag.
- Ensure that you have an AWS account with administrator privileges.
- Ensure that you know the AWS region in which Cloudera Cloud Factory creates resources.
- Ensure that you know the ARN of the principal that is allowed to assume the DelegatedAdmin role, for example, the Cloudera Cloud Factory control-plane role.
-
In the AWS Management Console, create the child boundary managed policy in IAM from the boundary.json file.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Ec2ScopedToWorkloadNeeds", "Effect": "Allow", "Action": [ "ec2:AssignPrivateIpAddresses", "ec2:AttachNetworkInterface", "ec2:AttachVolume", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:CreateNetworkInterface", "ec2:CreateRoute", "ec2:CreateSecurityGroup", "ec2:CreateSnapshot", "ec2:CreateTags", "ec2:CreateVolume", "ec2:DeleteNetworkInterface", "ec2:DeleteRoute", "ec2:DeleteSecurityGroup", "ec2:DeleteSnapshot", "ec2:DeleteTags", "ec2:DeleteVolume", "ec2:Describe*", "ec2:DetachNetworkInterface", "ec2:DetachVolume", "ec2:ModifyInstanceAttribute", "ec2:ModifyNetworkInterfaceAttribute", "ec2:ModifyVolume", "ec2:ReplaceRoute", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "ec2:UnassignPrivateIpAddresses" ], "Resource": "*" }, { "Sid": "ElbFull", "Effect": "Allow", "Action": "elasticloadbalancing:*", "Resource": "*" }, { "Sid": "S3ObjectCrudOnKubernetesBucketsOnly", "Effect": "Allow", "Action": [ "s3:AbortMultipartUpload", "s3:DeleteObject", "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:ListMultipartUploadParts", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::kubernetes-*", "arn:aws:s3:::kubernetes-*/*" ] }, { "Sid": "EcrPullReadOnly", "Effect": "Allow", "Action": [ "ecr:BatchCheckLayerAvailability", "ecr:BatchGetImage", "ecr:DescribeRepositories", "ecr:GetAuthorizationToken", "ecr:GetDownloadUrlForLayer", "ecr:GetRepositoryPolicy", "ecr:ListImages" ], "Resource": "*" }, { "Sid": "EfsAccessPointSubset", "Effect": "Allow", "Action": [ "elasticfilesystem:CreateAccessPoint", "elasticfilesystem:DeleteAccessPoint", "elasticfilesystem:DescribeAccessPoints", "elasticfilesystem:DescribeFileSystems", "elasticfilesystem:DescribeMountTargets", "elasticfilesystem:TagResource" ], "Resource": "*" }, { "Sid": "ServiceLinkedRoleForElbOnly", "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "*", "Condition": { "StringLike": { "iam:AWSServiceName": "elasticloadbalancing.amazonaws.com" } } } ] }The child boundary is the permission boundary on every child role that the DelegatedAdmin role creates. A child role is a Kubernetes workload identity, so the boundary is a guardrails-only cap that matches what its attached policies need: the Amazon EBS CSI driver, the AWS cloud provider, and the AWS Load Balancer Controller.
The following table shows what the child boundary allows. Everything that the table does not list is denied by omission, even when
AdministratorAccessis attached.Table 1. Child boundary permissions Capability Allowed A scoped set of EC2 actions: read ( ec2:Describe*), volumes, snapshots, tags, security groups, network interfaces and private IP addresses, routes, andec2:ModifyInstanceAttributeYes All EC2 actions ( ec2:*)No Other EC2 actions, such as ec2:RunInstancesandec2:DeleteVpcNo All elasticloadbalancingactionsYes S3 object operations ( GetObject,PutObject,DeleteObject,ListBucket,GetBucketLocation, and multipart upload) on buckets namedkubernetes-*Yes S3 bucket administration, such as DeleteBucket,PutBucketPolicy, and ACLsNo ECR pull actions, such as GetAuthorizationTokenandBatchGetImageYes ECR push actions, such as PutImageNo EFS access-point actions, such as CreateAccessPoint, and read access to file systems and mount targetsYes EFS CreateFileSystemNo iam:CreateServiceLinkedRoleforelasticloadbalancing.amazonaws.comonlyYes General IAM, including creating roles or policies No Route 53 No Any service that the boundary does not list, such as DynamoDB No -
Create the DelegatedAdmin boundary managed policy in IAM from the boundary-delegated-admin.json file, and substitute the template values.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ReadOnlyEverywhere", "Effect": "Allow", "Action": [ "ec2:Describe*", "iam:Get*", "iam:List*", "pricing:Get*", "servicequotas:List*", "sts:GetCallerIdentity", "tag:Get*" ], "Resource": "*" }, { "Sid": "CreateResourcesOnlyWhenTagged", "Effect": "Allow", "Action": [ "ec2:AllocateAddress", "ec2:CreateEgressOnlyInternetGateway", "ec2:CreateInternetGateway", "ec2:CreateNatGateway", "ec2:CreateRouteTable", "ec2:CreateSecurityGroup", "ec2:CreateSubnet", "ec2:CreateTags", "ec2:CreateVpc", "ec2:RunInstances", "iam:CreateInstanceProfile", "iam:CreatePolicy" ], "Resource": "*", "Condition": { "StringEquals": { "aws:RequestTag/${PB_TAG_KEY}": "${PB_TAG_VALUE}" } } }, { "Sid": "CreateRoleOnlyWhenTaggedAndBounded", "Effect": "Allow", "Action": "iam:CreateRole", "Resource": "*", "Condition": { "StringEquals": { "aws:RequestTag/${PB_TAG_KEY}": "${PB_TAG_VALUE}", "iam:PermissionsBoundary": "${BOUNDARY_ARN}" } } }, { "Sid": "ModifyDeleteOnlyWhenResourceTagged", "Effect": "Allow", "Action": [ "ec2:AssociateAddress", "ec2:AssociateRouteTable", "ec2:AttachInternetGateway", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:CreateRoute", "ec2:CreateTags", "ec2:DeleteEgressOnlyInternetGateway", "ec2:DeleteInternetGateway", "ec2:DeleteNatGateway", "ec2:DeleteRoute", "ec2:DeleteRouteTable", "ec2:DeleteSecurityGroup", "ec2:DeleteSubnet", "ec2:DeleteTags", "ec2:DeleteVpc", "ec2:DetachInternetGateway", "ec2:DisassociateAddress", "ec2:DisassociateRouteTable", "ec2:ModifyInstanceAttribute", "ec2:ModifySubnetAttribute", "ec2:ModifyVpcAttribute", "ec2:RebootInstances", "ec2:ReleaseAddress", "ec2:ReplaceRoute", "ec2:ReplaceRouteTableAssociation", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "ec2:StartInstances", "ec2:StopInstances", "ec2:TerminateInstances", "iam:AddRoleToInstanceProfile", "iam:AttachRolePolicy", "iam:CreatePolicyVersion", "iam:DeleteInstanceProfile", "iam:DeletePolicy", "iam:DeletePolicyVersion", "iam:DeleteRole", "iam:DeleteRolePolicy", "iam:DetachRolePolicy", "iam:PutRolePolicy", "iam:RemoveRoleFromInstanceProfile", "iam:SetDefaultPolicyVersion", "iam:TagInstanceProfile", "iam:TagPolicy", "iam:TagRole", "iam:UntagInstanceProfile", "iam:UntagPolicy", "iam:UntagRole", "iam:UpdateAssumeRolePolicy", "iam:UpdateRole" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/${PB_TAG_KEY}": "${PB_TAG_VALUE}" } } }, { "Sid": "ProtectBoundaryPolicies", "Effect": "Deny", "Action": [ "iam:CreatePolicyVersion", "iam:DeletePolicy", "iam:DeletePolicyVersion", "iam:SetDefaultPolicyVersion" ], "Resource": [ "${BOUNDARY_ARN}", "arn:aws:iam::${ACCOUNT_ID}:policy/${DELEG_BOUNDARY_NAME}" ] }, { "Sid": "NeverRemoveOrWeakenBoundary", "Effect": "Deny", "Action": [ "iam:DeleteRolePermissionsBoundary", "iam:PutRolePermissionsBoundary" ], "Resource": "*", "Condition": { "StringNotEquals": { "iam:PermissionsBoundary": "${BOUNDARY_ARN}" } } }, { "Sid": "DenyOutsideAllowedRegion", "Effect": "Deny", "NotAction": [ "iam:*", "sts:*", "tag:*", "pricing:*", "ec2:DescribeRegions" ], "Resource": "*", "Condition": { "StringNotEquals": { "aws:RequestedRegion": "${PB_REGION}" } } }, { "Sid": "AllowCreateResourcesWithinExistingVpc", "Effect": "Allow", "Action": "ec2:CreateSecurityGroup", "Resource": "arn:aws:ec2:*:*:vpc/*" }, { "Sid": "AllowRunInstancesOnSupportingResources", "Effect": "Allow", "Action": "ec2:RunInstances", "Resource": [ "arn:aws:ec2:*:*:network-interface/*", "arn:aws:ec2:*:*:subnet/*", "arn:aws:ec2:*:*:security-group/*", "arn:aws:ec2:*:*:volume/*", "arn:aws:ec2:*:*:key-pair/*", "arn:aws:ec2:*:*:image/*" ] }, { "Sid": "AllowAddressAssociationOnNetworkInterfaces", "Effect": "Allow", "Action": [ "ec2:AssociateAddress", "ec2:DisassociateAddress" ], "Resource": "arn:aws:ec2:*:*:network-interface/*" }, { "Sid": "PassRoleOnlyForTaggedRoles", "Effect": "Allow", "Action": "iam:PassRole", "Condition": { "StringEquals": { "iam:ResourceTag/${PB_TAG_KEY}": "${PB_TAG_VALUE}" } }, "Resource": "*" }, { "Sid": "PassRoleToEC2Service", "Effect": "Allow", "Action": "iam:PassRole", "Condition": { "StringEquals": { "iam:PassedToService": "ec2.amazonaws.com" } }, "Resource": "*" }, { "Sid": "AllowKubernetesDiscoveryTagging", "Effect": "Allow", "Action": [ "ec2:CreateTags", "ec2:DeleteTags" ], "Condition": { "ForAllValues:StringLike": { "aws:TagKeys": [ "kubernetes.io/cluster/*", "kubernetes.io/role/*" ] } }, "Resource": "*" } ] }The following table lists the values to substitute in the policy files in this procedure:
Table 2. Template values File Value to substitute Default boundary-delegated-admin.json Tag key ccf.cloudera.com/managedboundary-delegated-admin.json Tag value trueboundary-delegated-admin.json ARN of the child boundary policy: [***CHILD BOUNDARY POLICY ARN***] None boundary-delegated-admin.json The region: [***REGION***] None boundary-delegated-admin.json The AWS account ID: [***ACCOUNT ID***] None boundary-delegated-admin.json The name of the DelegatedAdmin boundary policy: [***DELEGATEDADMIN BOUNDARY POLICY NAME***] None trust-delegated-admin.json ARN of the principal that is allowed to assume DelegatedAdmin: [***PRINCIPAL ARN***] None trust-child.json ARN of the DelegatedAdmin role: [***DELEGATEDADMIN ROLE ARN***] None The tag key and tag value must not contain quotation marks, backslashes, or newline characters. After you substitute the values, ensure that no
${...}placeholders remain in the policy files.The DelegatedAdmin boundary enforces the following rules:
- Read-only access (
ec2:Describe*,iam:Get*,iam:List*,pricing:Get*,servicequotas:List*,tag:Get*, andsts:GetCallerIdentity), so that the role can inspect resources that it did not create and look up prices and service quotas. EC2 and Service Quotas reads are locked to the configured region; IAM, STS, tagging, and Pricing API reads are not. - Creation of EC2 instances, VPCs, subnets, route tables, security groups, internet gateways, egress-only internet gateways, NAT gateways, Elastic IP addresses, IAM policies, and instance profiles only when the request carries the tag
ccf.cloudera.com/managed=true(aws:RequestTag). - Modification or deletion of these resources only when the resource already carries the tag (
aws:ResourceTag). This covers routes and route table associations, gateway attachments, Elastic IP associations, security group rules, starting, stopping, rebooting, and terminating instances, and changes to tagged IAM roles, policies, and instance profiles. - Creation of an IAM role (
iam:CreateRole) only when the new role carries the tag and has the child boundary set as its permission boundary (iam:PermissionsBoundary). A delegated role can therefore never be more powerful than the child boundary. - Creation of security groups in any VPC, including a VPC that Cloudera Cloud Factory did not create. The security group itself must carry the tag.
- Launch of tagged EC2 instances into existing subnets and security groups, with existing network interfaces, volumes, key pairs, and images.
- Association of Elastic IP addresses with any network interface.
- Passing of roles (
iam:PassRole) only when the role carries the tag, or when the role is passed to the EC2 service (ec2.amazonaws.com). - Adding and removing tags whose keys start with
kubernetes.io/cluster/orkubernetes.io/role/on any EC2 resource, so that Kubernetes can discover subnets and other resources. - No deletion of either boundary policy, no creation of new versions of either boundary policy, and no removal of the permission boundary from any role, even a tagged one. The role can set a permission boundary on a role only to the child boundary.
- Region lock: every action except IAM, STS, tagging (
tag:*), Pricing API, andec2:DescribeRegionsactions is denied outside the configured region. The role cannot create a VPC in another region, even a tagged one, and cannot describe VPCs there. - No creation of S3 buckets, despite
AdministratorAccess. The boundary does not allow any service that it does not list, such as Amazon S3, Elastic Load Balancing, Amazon EFS, Amazon EKS, or Route 53.
The following table shows how the tag gates resource management:
Table 3. Tag-gated resource management Resource Create tagged Create untagged Modify or delete tagged Modify or delete untagged EC2 instance Allowed Denied Allowed Denied VPC and subnet Allowed Denied Allowed Denied Route table, route, and association Allowed Denied Allowed Denied Internet, egress-only internet, and NAT gateway Allowed Denied Allowed Denied Elastic IP address Allowed Denied Allowed Denied IAM policy and instance profile Allowed Denied Allowed Denied Security group Allowed Denied Allowed Denied IAM role Allowed, only with the child boundary Denied Allowed Denied - Read-only access (
-
Create the DelegatedAdmin role in IAM with the trust policy from the trust-delegated-admin.json file.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "${DELEG_TRUST_PRINCIPAL_ARN}" }, "Action": "sts:AssumeRole" } ] }In the trust policy, name the Cloudera Cloud Factory control-plane role or another specific principal as the principal that is allowed to assume the DelegatedAdmin role.
-
Attach the AWS managed
AdministratorAccesspolicy to the DelegatedAdmin role. - Set the DelegatedAdmin boundary policy as the permission boundary of the DelegatedAdmin role.
The DelegatedAdmin role can create regional resources only in the configured region, can modify or delete only resources that are tagged ccf.cloudera.com/managed=true, and every role that it creates carries the child boundary.
The trust policy of each child role, defined in the trust-child.json file, names the DelegatedAdmin role as the principal that is allowed to assume the child role.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "${DELEG_ROLE_ARN}"
},
"Action": "sts:AssumeRole"
}
]
}
