airflow.providers.amazon.aws.hooks.eks

Interact with Amazon EKS, using the boto3 library.

Module Contents

Classes

ClusterStates

Contains the possible State values of an EKS Cluster.

FargateProfileStates

Contains the possible State values of an AWS Fargate profile.

NodegroupStates

Contains the possible State values of an EKS Managed Nodegroup.

EksHook

Interact with Amazon EKS, using the boto3 library.

EKSHook

This hook is deprecated.

Attributes

DEFAULT_PAGINATION_TOKEN

STS_TOKEN_EXPIRES_IN

AUTHENTICATION_API_VERSION

airflow.providers.amazon.aws.hooks.eks.DEFAULT_PAGINATION_TOKEN =[source]
airflow.providers.amazon.aws.hooks.eks.STS_TOKEN_EXPIRES_IN = 60[source]
airflow.providers.amazon.aws.hooks.eks.AUTHENTICATION_API_VERSION = client.authentication.k8s.io/v1alpha1[source]
class airflow.providers.amazon.aws.hooks.eks.ClusterStates[source]

Bases: enum.Enum

Contains the possible State values of an EKS Cluster.

CREATING = CREATING[source]
ACTIVE = ACTIVE[source]
DELETING = DELETING[source]
FAILED = FAILED[source]
UPDATING = UPDATING[source]
NONEXISTENT = NONEXISTENT[source]
class airflow.providers.amazon.aws.hooks.eks.FargateProfileStates[source]

Bases: enum.Enum

Contains the possible State values of an AWS Fargate profile.

CREATING = CREATING[source]
ACTIVE = ACTIVE[source]
DELETING = DELETING[source]
CREATE_FAILED = CREATE_FAILED[source]
DELETE_FAILED = DELETE_FAILED[source]
NONEXISTENT = NONEXISTENT[source]
class airflow.providers.amazon.aws.hooks.eks.NodegroupStates[source]

Bases: enum.Enum

Contains the possible State values of an EKS Managed Nodegroup.

CREATING = CREATING[source]
ACTIVE = ACTIVE[source]
UPDATING = UPDATING[source]
DELETING = DELETING[source]
CREATE_FAILED = CREATE_FAILED[source]
DELETE_FAILED = DELETE_FAILED[source]
DEGRADED = DEGRADED[source]
NONEXISTENT = NONEXISTENT[source]
class airflow.providers.amazon.aws.hooks.eks.EksHook(*args, **kwargs)[source]

Bases: airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook

Interact with Amazon EKS, using the boto3 library.

Additional arguments (such as aws_conn_id) may be specified and are passed down to the underlying AwsBaseHook.

See also

AwsBaseHook

client_type = eks[source]
create_cluster(self, name, roleArn, resourcesVpcConfig, **kwargs)[source]

Creates an Amazon EKS control plane.

Parameters
  • name (str) – The unique name to give to your Amazon EKS Cluster.

  • roleArn (str) – The Amazon Resource Name (ARN) of the IAM role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf.

  • resourcesVpcConfig (Dict) – The VPC configuration used by the cluster control plane.

Returns

Returns descriptive information about the created EKS Cluster.

Return type

Dict

create_nodegroup(self, clusterName, nodegroupName, subnets, nodeRole, *, tags=None, **kwargs)[source]

Creates an Amazon EKS managed node group for an Amazon EKS Cluster.

Parameters
  • clusterName (str) – The name of the Amazon EKS cluster to create the EKS Managed Nodegroup in.

  • nodegroupName (str) – The unique name to give your managed nodegroup.

  • subnets (List[str]) – The subnets to use for the Auto Scaling group that is created for your nodegroup.

  • nodeRole (Optional[str]) – The Amazon Resource Name (ARN) of the IAM role to associate with your nodegroup.

  • tags (Optional[Dict]) – Optional tags to apply to your nodegroup.

Returns

Returns descriptive information about the created EKS Managed Nodegroup.

Return type

Dict

create_fargate_profile(self, clusterName, fargateProfileName, podExecutionRoleArn, selectors, **kwargs)[source]

Creates an AWS Fargate profile for an Amazon EKS cluster.

Parameters
  • clusterName (str) – The name of the Amazon EKS cluster to apply the Fargate profile to.

  • fargateProfileName (Optional[str]) – The name of the Fargate profile.

  • podExecutionRoleArn (Optional[str]) – The Amazon Resource Name (ARN) of the pod execution role to use for pods that match the selectors in the Fargate profile.

  • selectors (List) – The selectors to match for pods to use this Fargate profile.

Returns

Returns descriptive information about the created Fargate profile.

Return type

Dict

delete_cluster(self, name)[source]

Deletes the Amazon EKS Cluster control plane.

Parameters

name (str) – The name of the cluster to delete.

Returns

Returns descriptive information about the deleted EKS Cluster.

Return type

Dict

delete_nodegroup(self, clusterName, nodegroupName)[source]

Deletes an Amazon EKS managed node group from a specified cluster.

Parameters
  • clusterName (str) – The name of the Amazon EKS Cluster that is associated with your nodegroup.

  • nodegroupName (str) – The name of the nodegroup to delete.

Returns

Returns descriptive information about the deleted EKS Managed Nodegroup.

Return type

Dict

delete_fargate_profile(self, clusterName, fargateProfileName)[source]

Deletes an AWS Fargate profile from a specified Amazon EKS cluster.

Parameters
  • clusterName (str) – The name of the Amazon EKS cluster associated with the Fargate profile to delete.

  • fargateProfileName (str) – The name of the Fargate profile to delete.

Returns

Returns descriptive information about the deleted Fargate profile.

Return type

Dict

describe_cluster(self, name, verbose=False)[source]

Returns descriptive information about an Amazon EKS Cluster.

Parameters
  • name (str) – The name of the cluster to describe.

  • verbose (bool) – Provides additional logging if set to True. Defaults to False.

Returns

Returns descriptive information about a specific EKS Cluster.

Return type

Dict

describe_nodegroup(self, clusterName, nodegroupName, verbose=False)[source]

Returns descriptive information about an Amazon EKS managed node group.

Parameters
  • clusterName (str) – The name of the Amazon EKS Cluster associated with the nodegroup.

  • nodegroupName (str) – The name of the nodegroup to describe.

  • verbose (bool) – Provides additional logging if set to True. Defaults to False.

Returns

Returns descriptive information about a specific EKS Nodegroup.

Return type

Dict

describe_fargate_profile(self, clusterName, fargateProfileName, verbose=False)[source]

Returns descriptive information about an AWS Fargate profile.

Parameters
  • clusterName (str) – The name of the Amazon EKS Cluster associated with the Fargate profile.

  • fargateProfileName (str) – The name of the Fargate profile to describe.

  • verbose (bool) – Provides additional logging if set to True. Defaults to False.

Returns

Returns descriptive information about an AWS Fargate profile.

Return type

Dict

get_cluster_state(self, clusterName)[source]

Returns the current status of a given Amazon EKS Cluster.

Parameters

clusterName (str) – The name of the cluster to check.

Returns

Returns the current status of a given Amazon EKS Cluster.

Return type

ClusterStates

get_fargate_profile_state(self, clusterName, fargateProfileName)[source]

Returns the current status of a given AWS Fargate profile.

Parameters
  • clusterName (str) – The name of the Amazon EKS Cluster associated with the Fargate profile.

  • fargateProfileName (str) – The name of the Fargate profile to check.

Returns

Returns the current status of a given AWS Fargate profile.

Return type

AWS FargateProfileStates

get_nodegroup_state(self, clusterName, nodegroupName)[source]

Returns the current status of a given Amazon EKS managed node group.

Parameters
  • clusterName (str) – The name of the Amazon EKS Cluster associated with the nodegroup.

  • nodegroupName (str) – The name of the nodegroup to check.

Returns

Returns the current status of a given Amazon EKS Nodegroup.

Return type

NodegroupStates

list_clusters(self, verbose=False)[source]

Lists all Amazon EKS Clusters in your AWS account.

Parameters

verbose (bool) – Provides additional logging if set to True. Defaults to False.

Returns

A List containing the cluster names.

Return type

List

list_nodegroups(self, clusterName, verbose=False)[source]

Lists all Amazon EKS managed node groups associated with the specified cluster.

Parameters
  • clusterName (str) – The name of the Amazon EKS Cluster containing nodegroups to list.

  • verbose (bool) – Provides additional logging if set to True. Defaults to False.

Returns

A List of nodegroup names within the given cluster.

Return type

List

list_fargate_profiles(self, clusterName, verbose=False)[source]

Lists all AWS Fargate profiles associated with the specified cluster.

Parameters
  • clusterName (str) – The name of the Amazon EKS Cluster containing Fargate profiles to list.

  • verbose (bool) – Provides additional logging if set to True. Defaults to False.

Returns

A list of Fargate profile names within a given cluster.

Return type

List

generate_config_file(self, eks_cluster_name, pod_namespace, pod_username=None, pod_context=None)[source]

Writes the kubeconfig file given an EKS Cluster.

Parameters
  • eks_cluster_name (str) – The name of the cluster to generate kubeconfig file for.

  • pod_namespace (Optional[str]) – The namespace to run within kubernetes.

fetch_access_token_for_cluster(self, eks_cluster_name)[source]
class airflow.providers.amazon.aws.hooks.eks.EKSHook(*args, **kwargs)[source]

Bases: EksHook

This hook is deprecated. Please use airflow.providers.amazon.aws.hooks.eks.EksHook.

Was this entry helpful?