1. Deploy the elastic-apm-server helm chart on AWS EKS


    To deploy the Elastic APM Server on AWS EKS using a Helm chart with Pulumi, you'll need to do several things:

    1. Set up an AWS EKS cluster.
    2. Deploy the Helm chart for the Elastic APM Server onto your EKS cluster.

    Below is a detailed Pulumi TypeScript program that accomplishes these tasks.

    First, you'll need to create an EKS cluster, which involves setting up the necessary roles, VPCs, and security groups. Once that's done, you can install applications—in this case, the Elastic APM Server—using Helm charts.


    Ensure you have the following installed:

    • Pulumi CLI
    • AWS CLI
    • Helm CLI
    • kubectl
    • Configure your AWS credentials, so Pulumi can access your AWS account.

    Program Explanation

    Setting up the EKS Cluster

    We use the eks.Cluster resource from the @pulumi/eks package (documentation) to create an EKS cluster. This resource abstracts away much of the complexity involved in setting up an EKS cluster, such as creating the VPC and defining node groups.

    Deploying the Helm Chart

    The kubernetes.helm.v3.Chart resource from the @pulumi/kubernetes package (documentation) represents a Helm chart—a package of pre-configured Kubernetes resources. It uses the Helm CLI to deploy and manage applications. Here, you target this resource to deploy the Elastic APM Server onto the EKS cluster you've created.

    Now, here's the complete program to set up the EKS cluster and deploy the Elastic APM Server:

    import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster with the default configuration. const cluster = new eks.Cluster("my-eks-cluster", {}); // Export the kubeconfig so that the Kubernetes client (kubectl) can connect to our cluster. export const kubeconfig = cluster.kubeconfig; // Deploy the elastic-apm-server Helm chart onto the EKS cluster. const elasticApmRelease = new k8s.helm.v3.Chart("elastic-apm-server", { chart: "elastic-apm-server", version: "7.11.2", // Specify the version of the chart you want to deploy. fetchOpts: { repo: "https://helm.elastic.co", // The repository where the Helm chart is hosted. } }, { provider: cluster.provider }); // Once you've finished setting up the program, you can run `pulumi up` to deploy your infrastructure.

    To deploy this program:

    1. Create a new Pulumi project in TypeScript.
    2. Save the above code into the index.ts file in your Pulumi project.
    3. Run pulumi up to preview and deploy the changes.

    You will see Pulumi performing the deployment steps, which includes creating the EKS cluster, followed by deploying the Helm chart.

    Additional Considerations

    You might need to configure your Helm chart with certain custom values or configurations. Adjust the values property of the Chart resource accordingly.

    Note that the version of the Elastic APM Server Helm chart may change; make sure to specify the version that matches your requirements.