Skip to content
v2.275.0

AwsAuth ​

Manages mapping between IAM users and roles to Kubernetes RBAC configuration.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_eks as eks } from 'aws-cdk-lib';

declare const cluster: eks.Cluster;
const awsAuth = new eks.AwsAuth(this, 'MyAwsAuth', {
  cluster: cluster,
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_eks as eks

# cluster: eks.Cluster

aws_auth = eks.AwsAuth(self, "MyAwsAuth",
    cluster=cluster
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.eks.*;

Cluster cluster;

AwsAuth awsAuth = AwsAuth.Builder.create(this, "MyAwsAuth")
        .cluster(cluster)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EKS;

Cluster cluster;

var awsAuth = new AwsAuth(this, "MyAwsAuth", new AwsAuthProps {
    Cluster = cluster
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var cluster Cluster

awsAuth := awscdk.Aws_eks.NewAwsAuth(this, jsii.String("MyAwsAuth"), &AwsAuthProps{
	Cluster: cluster,
})

Initializer ​

ts
new AwsAuth(scope: Construct, id: string, props: AwsAuthProps)
python
AwsAuth(scope: Construct, id: str, props: AwsAuthProps)
java
new AwsAuth(Construct scope, String id, AwsAuthProps props)
csharp
new AwsAuth(Construct scope, string id, AwsAuthProps props)
go
NewAwsAuth(Scope Construct, Id *string, Props AwsAuthProps)

Construct Props ​

clusterClusterclusterClusterclusterClusterClusterClusterClusterClusterrequired#
The EKS cluster to apply this configuration to.

[disable-awslint:ref-via-interface]

Properties ​

nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.

Methods ​

addAccount(accountId: string): voiddef add_account(self, account_id: str) -> Nonepublic void addAccount(String accountId)public void AddAccount(string accountId)func AddAccount(AccountId *string)#
Additional AWS account to add to the aws-auth configmap.
1 parameter

Parameters

  • accountIdaccount_idaccountIdaccountIdAccountId — account number.
addMastersRole(role: IRole, username?: string): voiddef add_masters_role(self, role: IRole, username: typing.Optional[str] = None) -> Nonepublic void addMastersRole(IRole role, String username)public void AddMastersRole(IRole role, string? username = null)func AddMastersRole(Role IRole, Username *string)#
Adds the specified IAM role to the `system:masters` RBAC group, which means that anyone that can assume it will be able to administer this Kubernetes system.
2 parameters

Parameters

  • roleroleroleroleRole — The IAM role to add.
  • usernameusernameusernameusernameUsername — Optional user (defaults to the role ARN).
addRoleMapping(role: IRole, mapping: AwsAuthMapping): voiddef add_role_mapping(self, role: IRole, mapping: AwsAuthMapping) -> Nonepublic void addRoleMapping(IRole role, AwsAuthMapping mapping)public void AddRoleMapping(IRole role, AwsAuthMapping mapping)func AddRoleMapping(Role IRole, Mapping AwsAuthMapping)#
Adds a mapping between an IAM role to a Kubernetes user and groups.
2 parameters

Parameters

  • roleroleroleroleRole — The IAM role to map.
  • mappingmappingmappingmappingMapping — Mapping to k8s user name and groups.
addUserMapping(user: IUser, mapping: AwsAuthMapping): voiddef add_user_mapping(self, user: IUser, mapping: AwsAuthMapping) -> Nonepublic void addUserMapping(IUser user, AwsAuthMapping mapping)public void AddUserMapping(IUser user, AwsAuthMapping mapping)func AddUserMapping(User IUser, Mapping AwsAuthMapping)#
Adds a mapping between an IAM user to a Kubernetes user and groups.
2 parameters

Parameters

  • useruseruseruserUser — The IAM user to map.
  • mappingmappingmappingmappingMapping — Mapping to k8s user name and groups.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining