PermissionsBoundary
- class aws_cdk.PermissionsBoundary(*args: Any, **kwargs)
Bases:
object
Apply a permissions boundary to all IAM Roles and Users within a specific scope.
A permissions boundary is typically applied at the
Stage
scope. This allows setting different permissions boundaries per Stage. For example, you may not apply a boundary to theDev
stage which deploys to a personal dev account, but you do apply the default boundary to theProd
stage.It is possible to apply different permissions boundaries to different scopes within your app. In this case the most specifically applied one wins
Example:
# no permissions boundary for dev stage Stage(app, "DevStage") # default boundary for prod stage prod_stage = Stage(app, "ProdStage", permissions_boundary=PermissionsBoundary.from_name("prod-pb") ) # overriding the pb applied for this stack Stack(prod_stage, "ProdStack1", permissions_boundary=PermissionsBoundary.from_name("stack-pb") ) # will inherit the permissions boundary from the stage Stack(prod_stage, "ProdStack2")
Static Methods
- classmethod from_arn(arn)
Apply a permissions boundary with the given ARN to all IAM Roles and Users created within a scope.
The arn can include placeholders for the partition, region, qualifier, and account These placeholders will be replaced with the actual values if available. This requires that the Stack has the environment specified, it does not work with environment agnostic stacks.
‘${AWS::Partition}’
‘${AWS::Region}’
‘${AWS::AccountId}’
‘${Qualifier}’
- Parameters:
arn (
str
) – the ARN of the permissions boundary policy.- Return type:
Example:
Stage(app, "ProdStage", permissions_boundary=PermissionsBoundary.from_arn("arn:aws:iam::${AWS::AccountId}:policy/my-custom-permissions-boundary") )
- classmethod from_name(name)
Apply a permissions boundary with the given name to all IAM Roles and Users created within a scope.
The name can include placeholders for the partition, region, qualifier, and account These placeholders will be replaced with the actual values if available. This requires that the Stack has the environment specified, it does not work with environment agnostic stacks.
‘${AWS::Partition}’
‘${AWS::Region}’
‘${AWS::AccountId}’
‘${Qualifier}’
- Parameters:
name (
str
) – the name of the permissions boundary policy.- Return type:
Example:
Stage(app, "ProdStage", permissions_boundary=PermissionsBoundary.from_name("my-custom-permissions-boundary") )