> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IAM permissions boundaries

An [IAM permissions boundary](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) sets the most a role can do: the role can only use permissions that both its own policies and its boundary allow. Managed BYOC uses boundaries to keep the IAM roles Superblocks uses in your account away from resources that aren't part of the Superblocks platform, even if a role's own policies were widened.

You can use the Superblocks default boundaries, or replace them with a boundary of your own.

## Roles a boundary covers

A boundary applies to every IAM role Superblocks uses in your Managed BYOC account:

* **The deployer role**, which the [bootstrap](https://docs.superblocks.com/enterprise/cloud-prem/deployment-guide.md#the-bootstrap) creates to deploy and upgrade your instance.
* **The support roles**, which the bootstrap creates for Superblocks support: the break-glass admin role and the read-only role.
* **Every role a deployment creates**, such as the roles for your instance's Kubernetes workloads, nodes, and controllers, and the [Superblocks Database](https://docs.superblocks.com/admin/superblocks-on-aws/database-setup.md) roles.

## Choose a boundary

| Option | How you set it | Boundaries used |
| - | - | - |
| [Superblocks default boundaries](#superblocks-default-boundaries) | On by default in the bootstrap's settings file, `superblocks.tfvars`, with `create_permissions_boundary = true` | Four boundaries the bootstrap creates, one for each group of roles |
| [Your own boundary](#bring-your-own-boundary) | Set `codebuild_permissions_boundary_arn` to the ARN of a policy you create | Your policy, on every role |

If you set `codebuild_permissions_boundary_arn`, your boundary replaces the defaults, and the bootstrap ignores `create_permissions_boundary`. If you set neither, no role carries a boundary.

## Superblocks default boundaries

The bootstrap creates four boundaries, one for each group of roles in the table below. Each is an IAM policy named `superblocks-permissions-boundary-<boundary>-<region>`, such as `superblocks-permissions-boundary-workload-us-west-2`.

A boundary only takes permissions away. It lists what a role can't do, and the role can't do those things even if its own policies allow them. A boundary never gives a role a permission its own policies don't grant.

| Boundary | Roles | What it denies |
| - | - | - |
| `codebuild` | The deployer role | IAM changes outside Superblocks roles and policies, and changes to your account's security controls. See [The deployer boundary](#the-deployer-boundary) |
| `workload` | The support roles, and most roles a deployment creates, such as the roles for Kubernetes workloads, Lambda\@Edge, CloudTrail, AWS Config, S3 replication, and log forwarding | All IAM and EC2 changes, data outside Superblocks resources, other AWS accounts, and other regions. See [The workload boundary](#the-workload-boundary) |
| `node` | Kubernetes node roles, and the VPC CNI and EBS CSI drivers | The same as `workload`, except EC2 changes are allowed. VPC flow logs that Superblocks doesn't own stay protected |
| `controller` | The EKS cluster role, the Karpenter and load balancer controllers, and the Superblocks Database roles | The same as `node`, except it can pass Superblocks roles to EC2 and RDS, manage Karpenter instance profiles and service-linked roles, and use RDS-managed secrets |

The boundaries don't restrict which KMS keys a role uses.

### The deployer boundary

The `codebuild` boundary denies the deployer role:

* Changing itself, the boundaries, or any role or policy the bootstrap creates.
* Changing or passing IAM roles, policies, or instance profiles that don't have Superblocks names.
* Creating a role that doesn't carry the `workload`, `node`, or `controller` boundary.
* Creating IAM users, groups, or long-lived credentials.
* Removing a permissions boundary.
* Changing OIDC providers other than your instance's EKS cluster issuers.
* Attaching policies to the support roles, other than the policies for RDS IAM authentication.
* Deleting or stopping CloudTrail trails or AWS Config recorders that Superblocks doesn't own.
* Turning off GuardDuty, Security Hub, Inspector, Macie, or IAM Access Analyzer.
* Changing AWS Organizations, account settings, SAML providers, or Direct Connect.

Otherwise, the deployer role is limited by its own policies, which are scoped to Superblocks resources.

### The workload boundary

The `workload` boundary denies:

* All IAM and EC2 changes.
* Data in resources without Superblocks names, in S3, Secrets Manager, Systems Manager Parameter Store, SQS, and DynamoDB.
* Changes in other AWS accounts.
* Account, identity, security service, and audit log changes.
* Requests outside your instance's [regions](#regions).

The `node` and `controller` boundaries deny the same, with the exceptions in the table above.

### Review the boundaries

The boundary policies ship with the bootstrap, in `terraform/permission-boundaries/`, one JSON file per boundary. The files contain example values, such as the region, that the bootstrap replaces with your instance's values. To see the exact policies before they're created, run `terraform plan`. After the bootstrap runs, the `permissions_boundary_policies` output shows them as created.

### Regions

The boundaries deny requests outside your instance's regions. The bootstrap includes:

* Your control plane region (`aws_region`).
* The region of each data plane.
* `us-east-1`, which CloudFront, Lambda\@Edge, and the Superblocks container registry need.

To add a data plane in a new region, re-run the bootstrap before that data plane's first deployment, so the boundaries include the new region. Until you do, that deployment fails with `AccessDenied`. If you attach the [optional service control policy](#optional-organization-policies), replace it with the newly rendered one too.

### Turn them on for an existing instance

New bootstraps turn the default boundaries on. If your instance was deployed without them, turn them on in this order:

1. Set `create_permissions_boundary = true` in `superblocks.tfvars` and run the bootstrap. It creates the boundaries and attaches them to the support roles.
2. Ask your deployment team to deploy. The deployment puts the right boundary on each existing role of your instance.
3. Re-run the bootstrap. It now attaches the `codebuild` boundary to the deployer role.

The bootstrap waits for step 2 because the `codebuild` boundary denies changes to roles without a boundary, which would block that deployment. Until then, `terraform plan` shows a warning and the deployer role has no boundary. Once the `codebuild` boundary is attached, it stays attached.

## Bring your own boundary

Use your own boundary if your organization requires its own policy on IAM roles.

1. Start from one of the [default boundaries](#review-the-boundaries) and edit it. Keep its first statement, `AllowAll`, which leaves each role's own policies in control, and add your own Deny statements for what roles can't do.

2. Create the policy in your Managed BYOC AWS account.

3. In `superblocks.tfvars`, set `codebuild_permissions_boundary_arn` to the policy's ARN. For example:

   ```hcl theme={null}
   codebuild_permissions_boundary_arn = "arn:aws:iam::123456789012:policy/acme-superblocks-boundary"
   ```

4. Run the bootstrap. It attaches your boundary to the deployer and support roles, and outputs it as `permissions_boundary_arn`.

5. Tell your deployment team. Deployments attach your boundary to every role they create.

Your boundary must allow what every role needs

Your boundary replaces all four default boundaries and goes on every role, so it must allow everything any Superblocks role's own policies grant. That includes EC2 and scoped IAM actions for the node and controller roles, not only the deployer's permissions. If it allows less, deployments fail with an `AccessDenied` error that names your boundary, or a role is created but fails with `AccessDenied` at runtime. Share any such error with your deployment team.

Your boundary is attached when each role is created. Boundaries like yours often deny `iam:PutRolePermissionsBoundary`, so a role that already exists can't take a new boundary. Set your boundary before your initial deployment if you can. To use your own boundary on an instance that's already deployed, talk to your deployment team first.

You keep your boundary up to date. Superblocks doesn't edit your policy. If a release needs a permission your boundary denies, your deployment team tells you what to allow.

## Optional organization policies

A permissions boundary can't control some things, such as who a role trusts. For more protection, the bootstrap includes two optional AWS Organizations policies. You attach them at your organization; the bootstrap doesn't.

| Policy | Where to find it | What it does |
| - | - | - |
| Service control policy (SCP) | The `service_control_policy` bootstrap output, rendered with your instance's regions | Enforces the account guards, audit log protections, and region lock on Superblocks roles only, including the deployer role. Your own roles aren't affected |
| Resource control policy (RCP) | `resource-control-policy.json` in the bootstrap. Replace `<your-organization-id>` with your organization ID | Lets only your organization, the Superblocks AWS account, and AWS services assume roles in your Managed BYOC account |

Neither policy applies to your organization's management account, and the resource control policy needs all features turned on in AWS Organizations. The resource control policy doesn't cover sign-ins through EKS OIDC providers.

With the service control policy attached, deleting AWS Config recorders fails. Detach it before you tear down an instance.

## Bootstrap settings reference

| Setting | Type | Default | Set it for |
| - | - | - | - |
| `create_permissions_boundary` | Boolean | `false`. The bootstrap's settings file sets it to `true` | Superblocks default boundaries. Ignored when `codebuild_permissions_boundary_arn` is set |
| `codebuild_permissions_boundary_arn` | IAM policy ARN | `null` | Your own boundary. Replaces the defaults on the deployer and support roles, and on every role deployments create |

### Bootstrap outputs

| Output | Description |
| - | - |
| `permissions_boundary_arn` | The boundary deployments attach to the roles they create: your boundary, or the Superblocks `workload` boundary. With the default boundaries, deployments put the `node` and `controller` boundaries on those roles instead |
| `permissions_boundary_policies` | The Superblocks default boundaries as created, with your instance's regions. Empty when you use your own boundary |
| `service_control_policy` | The optional service control policy, rendered with your instance's regions |

## Related

* [Optional configurations](https://docs.superblocks.com/enterprise/cloud-prem/configure/index.md)
* [AWS Network Firewall](https://docs.superblocks.com/enterprise/cloud-prem/configure/network-firewall.md)
* [Managed BYOC deployment guide](https://docs.superblocks.com/enterprise/cloud-prem/deployment-guide.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.