Skip to content
v2.278.0

CfnPodIdentityAssociationProps Struct ​

Properties for defining a CfnPodIdentityAssociation.

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';
const cfnPodIdentityAssociationProps: eks.CfnPodIdentityAssociationProps = {
  clusterName: 'clusterName',
  namespace: 'namespace',
  roleArn: 'roleArn',
  serviceAccount: 'serviceAccount',

  // the properties below are optional
  disableSessionTags: false,
  policy: 'policy',
  tags: [{
    key: 'key',
    value: 'value',
  }],
  targetRoleArn: 'targetRoleArn',
  workloadIdentityConfig: {
    enabled: false,

    // the properties below are optional
    providerArn: 'providerArn',
    templateArn: 'templateArn',
  },
};
python
from aws_cdk import CfnTag
# 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

cfn_pod_identity_association_props = eks.CfnPodIdentityAssociationProps(
    cluster_name="clusterName",
    namespace="namespace",
    role_arn="roleArn",
    service_account="serviceAccount",

    # the properties below are optional
    disable_session_tags=False,
    policy="policy",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    target_role_arn="targetRoleArn",
    workload_identity_config=eks.CfnPodIdentityAssociation.WorkloadIdentityConfigProperty(
        enabled=False,

        # the properties below are optional
        provider_arn="providerArn",
        template_arn="templateArn"
    )
)
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.*;

CfnPodIdentityAssociationProps cfnPodIdentityAssociationProps = CfnPodIdentityAssociationProps.builder()
        .clusterName("clusterName")
        .namespace("namespace")
        .roleArn("roleArn")
        .serviceAccount("serviceAccount")

        // the properties below are optional
        .disableSessionTags(false)
        .policy("policy")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .targetRoleArn("targetRoleArn")
        .workloadIdentityConfig(WorkloadIdentityConfigProperty.builder()
                .enabled(false)

                // the properties below are optional
                .providerArn("providerArn")
                .templateArn("templateArn")
                .build())
        .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;

var cfnPodIdentityAssociationProps = new CfnPodIdentityAssociationProps {
    ClusterName = "clusterName",
    Namespace = "namespace",
    RoleArn = "roleArn",
    ServiceAccount = "serviceAccount",

    // the properties below are optional
    DisableSessionTags = false,
    Policy = "policy",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    TargetRoleArn = "targetRoleArn",
    WorkloadIdentityConfig = new WorkloadIdentityConfigProperty {
        Enabled = false,

        // the properties below are optional
        ProviderArn = "providerArn",
        TemplateArn = "templateArn"
    }
};
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"

cfnPodIdentityAssociationProps := &CfnPodIdentityAssociationProps{
	ClusterName: jsii.String("clusterName"),
	Namespace: jsii.String("namespace"),
	RoleArn: jsii.String("roleArn"),
	ServiceAccount: jsii.String("serviceAccount"),

	// the properties below are optional
	DisableSessionTags: jsii.Boolean(false),
	Policy: jsii.String("policy"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	TargetRoleArn: jsii.String("targetRoleArn"),
	WorkloadIdentityConfig: &WorkloadIdentityConfigProperty{
		Enabled: jsii.Boolean(false),

		// the properties below are optional
		ProviderArn: jsii.String("providerArn"),
		TemplateArn: jsii.String("templateArn"),
	},
}

Properties ​

clusterNamestringcluster_namestrclusterNameStringClusterNamestringClusterName*string required #
The name of the cluster that the association is in.
disableSessionTagsoptionalboolean | IResolvabledisable_session_tagsoptionaltyping.Union[bool, IResolvable]disableSessionTagsoptionalBooleanDisableSessionTagsoptionalboolDisableSessionTagsoptionalinterface{} #
The state of the automatic sessions tags. The value of *true* disables these tags.
notes

EKS Pod Identity adds a pre-defined set of session tags when it assumes the role. You can use these tags to author a single role that can work across resources by allowing access to AWS resources based on matching tags. By default, EKS Pod Identity attaches six tags, including tags for cluster name, namespace, and service account name. For the list of tags added by EKS Pod Identity, see List of session tags added by EKS Pod Identity in the Amazon EKS User Guide .

namespacestringnamespacestrnamespaceStringNamespacestringNamespace*string required #
The name of the Kubernetes namespace inside the cluster to create the association in.

The service account and the Pods that use the service account must be in this namespace.

policyoptionalstringpolicyoptionalstrpolicyoptionalStringPolicyoptionalstringPolicyoptional*string #
The policy of the pod identity association.
roleArnstringrole_arnstrroleArnStringRoleArnstringRoleArn*string required #
The Amazon Resource Name (ARN) of the IAM role to associate with the service account.

The EKS Pod Identity agent manages credentials to assume this role for applications in the containers in the Pods that use this service account.

serviceAccountstringservice_accountstrserviceAccountStringServiceAccountstringServiceAccount*string required #
The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
Metadata that assists with categorization and organization.
notes

Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or AWS resources.

The following basic restrictions apply to tags:

  • Maximum number of tags per resource – 50
  • For each resource, each tag key must be unique, and each tag key can have only one value.
  • Maximum key length – 128 Unicode characters in UTF-8
  • Maximum value length – 256 Unicode characters in UTF-8
  • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : /
targetRoleArnoptionalstringtarget_role_arnoptionalstrtargetRoleArnoptionalStringTargetRoleArnoptionalstringTargetRoleArnoptional*string #
The Amazon Resource Name (ARN) of the target IAM role to associate with the service account.

This role is assumed by using the EKS Pod Identity association role, then the credentials for this role are injected into the Pod.

workloadIdentityConfigoptionalIResolvable | CfnPodIdentityAssociation.WorkloadIdentityConfigPropertyworkload_identity_configoptionaltyping.Union[IResolvable, WorkloadIdentityConfigProperty]workloadIdentityConfigoptionalIResolvableWorkloadIdentityConfigoptionalIResolvableWorkloadIdentityConfigoptionalinterface{} #
The workload identity configuration of the pod identity association.
notes

When enabled, the association also provisions a SPIFFE identity for the workload. Setting Enabled to false disables workload identity and keeps the ARNs. Removing the property from the template leaves the association unchanged; set Enabled to false to disable workload identity.