{"library":"pulumi-eks","title":"Pulumi EKS Components","description":"Pulumi EKS (Elastic Kubernetes Service) is a component package for provisioning and managing Amazon EKS clusters and their associated resources (VPC, IAM, Node Groups, Fargate profiles, etc.) using Python, TypeScript, Go, or C#. It simplifies EKS cluster deployment by encapsulating common patterns and best practices. The current version is 4.2.0, with frequent updates that often reflect changes in the underlying Pulumi AWS provider.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pulumi-eks"],"cli":null},"imports":["from pulumi_eks import Cluster"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pulumi\nimport pulumi_aws as aws\nimport pulumi_eks as eks\nimport os\n\n# Ensure AWS region is configured.\n# For a project, use `pulumi config set aws:region us-west-2`.\n# For this quickstart to run, ensure AWS_REGION or AWS_DEFAULT_REGION env var is set,\n# or you have a default region configured in your AWS credentials file.\nif not pulumi.Config(\"aws\").get(\"region\") and not os.environ.get('AWS_REGION') and not os.environ.get('AWS_DEFAULT_REGION'):\n    raise Exception(\"AWS region must be configured via `pulumi config set aws:region <region-name>` or environment variables.\")\n\n# Create an IAM role for the EKS Cluster and Node Groups.\n# This role grants permissions for EKS to manage resources and for nodes to join the cluster.\neks_cluster_role = aws.iam.Role(\"eks-cluster-role\",\n    assume_role_policy=aws.iam.get_policy_document(\n        statements=[aws.iam.GetPolicyDocumentStatementArgs(\n            actions=[\"sts:AssumeRole\"],\n            principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(\n                type=\"Service\",\n                identifiers=[\"eks.amazonaws.com\"],\n            )],\n        )]\n    ).json\n)\n\naws.iam.RolePolicyAttachment(\"eks-cluster-policy\",\n    role=eks_cluster_role.name,\n    policy_arn=\"arn:aws:iam::aws:policy/AmazonEKSClusterPolicy\"\n)\naws.iam.RolePolicyAttachment(\"eks-vpc-cni-policy\",\n    role=eks_cluster_role.name,\n    policy_arn=\"arn:aws:iam::aws:policy/AmazonEKSVPCResourceController\"\n)\n\n# Create the EKS cluster.\n# By omitting `vpc_id` and `subnet_ids`, pulumi-eks will create a new VPC and public subnets.\ncluster = eks.Cluster(\"my-eks-cluster\",\n    role_arn=eks_cluster_role.arn,\n    instance_type=\"t2.medium\", # Default instance type for worker nodes\n    desired_capacity=2,\n    min_size=1,\n    max_size=3,\n    version=\"1.28\" # Explicitly pin EKS Kubernetes version\n)\n\n# Export the cluster's name and kubeconfig\npulumi.export(\"cluster_name\", cluster.name)\npulumi.export(\"kubeconfig\", cluster.kubeconfig)\n","lang":"python","description":"This quickstart deploys a basic EKS cluster with two `t2.medium` worker nodes. It creates the necessary IAM roles and, by default, a new VPC and public subnets. Ensure your AWS credentials are configured and your AWS region is set via `pulumi config set aws:region <region-name>` or environment variables.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}