AccessPolicy

class aws_cdk.aws_eks_v2.AccessPolicy(*, access_scope, policy)

Bases: object

Represents an Amazon EKS Access Policy that implements the IAccessPolicy interface.

Implements:

IAccessPolicy

ExampleMetadata:

infused

Example:

# cluster: eks.Cluster
# node_role: iam.Role


# Grant access with EC2 type for Auto Mode node role
cluster.grant_access("nodeAccess", node_role.role_arn, [
    eks.AccessPolicy.from_access_policy_name("AmazonEKSAutoNodePolicy",
        access_scope_type=eks.AccessScopeType.CLUSTER
    )
], access_entry_type=eks.AccessEntryType.EC2)

Constructs a new instance of the AccessPolicy class.

Parameters:
  • access_scope (Union[AccessScope, Dict[str, Any]]) – The scope of the access policy, which determines the level of access granted.

  • policy (AccessPolicyArn) – The access policy itself, which defines the specific permissions.

Attributes

access_scope

The scope of the access policy, which determines the level of access granted.

policy

The access policy itself, which defines the specific permissions.

Static Methods

classmethod from_access_policy_name(policy_name, *, access_scope_type, namespaces=None)

Import AccessPolicy by name.

Parameters:
  • policy_name (str)

  • access_scope_type (AccessScopeType) – The scope of the access policy. This determines the level of access granted by the policy.

  • namespaces (Optional[Sequence[str]]) – An optional array of Kubernetes namespaces to which the access policy applies. Default: - no specific namespaces for this scope

Return type:

IAccessPolicy