Skip to main content

The CDK Construct Library for AWS::EKS

Project description

Amazon EKS Construct Library


Stability: Experimental

This is a developer preview (public beta) module. Releases might lack important features and might have future breaking changes.

This API is still under active development and subject to non-backward compatible changes or removal in any future version. Use of the API is not recommended in production environments. Experimental APIs are not subject to the Semantic Versioning model.


This construct library allows you to define and create Amazon Elastic Container Service for Kubernetes (EKS) clusters programmatically.

Example

The following example shows how to start an EKS cluster and how to add worker nodes to it:

    const vpc = new ec2.Vpc(this, 'VPC');

    const cluster = new eks.Cluster(this, 'EKSCluster', {
      vpc
    });

    cluster.addCapacity('Nodes', {
      instanceType: new ec2.InstanceType('t2.medium'),
      desiredCapacity: 1,  // Raise this number to add more nodes
    });

After deploying the previous CDK app you still need to configure kubectl and manually add the nodes to your cluster, as described in the EKS user guide.

SSH into your nodes

If you want to be able to SSH into your worker nodes, you must already have an SSH key in the region you're connecting to and pass it, and you must be able to connect to the hosts (meaning they must have a public IP and you should be allowed to connect to them on port 22):

    const asg = cluster.addCapacity('Nodes', {
      instanceType: new ec2.InstanceType('t2.medium'),
      vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
      keyName: 'my-key-name',
    });

    // Replace with desired IP
    asg.connections.allowFrom(ec2.Peer.ipv4('1.2.3.4/32'), ec2.Port.tcp(22));

If you want to SSH into nodes in a private subnet, you should set up a bastion host in a public subnet. That setup is recommended, but is unfortunately beyond the scope of this documentation.

Roadmap

  • Add ability to start tasks on clusters using CDK (similar to ECS's "Service" concept).
  • Describe how to set up AutoScaling (how to combine EC2 and Kubernetes scaling)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-cdk.aws-eks-0.39.0.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_cdk.aws_eks-0.39.0-py3-none-any.whl (60.9 kB view details)

Uploaded Python 3

File details

Details for the file aws-cdk.aws-eks-0.39.0.tar.gz.

File metadata

  • Download URL: aws-cdk.aws-eks-0.39.0.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.5

File hashes

Hashes for aws-cdk.aws-eks-0.39.0.tar.gz
Algorithm Hash digest
SHA256 1fc7c6001a93dad7b2f525c74c4ded70f94bf3e9c0b6b6626bed67c69aadd696
MD5 a7d5dea38dd32032a123ca455752eb55
BLAKE2b-256 bc59ee1f2c761ef2495cbe04b6497b9c0e3c6ed99317773a87ac953e9a9c0f8b

See more details on using hashes here.

File details

Details for the file aws_cdk.aws_eks-0.39.0-py3-none-any.whl.

File metadata

  • Download URL: aws_cdk.aws_eks-0.39.0-py3-none-any.whl
  • Upload date:
  • Size: 60.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.5

File hashes

Hashes for aws_cdk.aws_eks-0.39.0-py3-none-any.whl
Algorithm Hash digest
SHA256 214ba9254733391786af048adbafd4d914a5e171e3df41eb5e58b2e8b5f03c92
MD5 f2dfe6f9857297a6515bcc057aad91fa
BLAKE2b-256 061a9df361a3c0ed9fa8bb95fc3e3c75a7d8289201cd09007484da164f110b45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page