Skip to main content

AWS Golang EKS cluster

Deploys a container into an EKS cluster with a Managed Node Group.

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set aws-go-eks
cd pulumi-examples/aws-go-eks

This example creates an AWS EKS Cluster and deploys a sample container application to it.

Prerequisites#

  1. Install Pulumi
  2. Configure AWS credentials
  3. Install Go
  4. Install aws-iam-authenticator
  5. Install kubectl

Deploying the example#

  1. Create a new stack, which is an isolated deployment target for this example:

    Terminal window
    pulumi stack init dev
  2. Set the AWS region to deploy into:

    Terminal window
    pulumi config set aws:region us-east-1 # any valid AWS region will work
  3. Install dependencies:

    Terminal window
    go mod download
  4. Deploy the stack:

    Terminal window
    pulumi up
  5. After 10-15 minutes, your cluster will be ready, and the kubeconfig JSON you’ll use to connect to the cluster will be available as an output. You can save this kubeconfig to a file like so:

    Terminal window
    pulumi stack output kubeconfig --show-secrets >kubeconfig.json

    Once you have this file in hand, you can interact with your new cluster as usual via kubectl:

    Terminal window
    KUBECONFIG=./kubeconfig.json kubectl get nodes
  6. Ensure that the application is running as expected:

    Terminal window
    curl $(pulumi stack output url)

Cleaning up#

Once you’re finished experimenting, tear down your stack’s resources by destroying and removing it:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.