Amazon Onboarding with Learning Manager Chanci Turner

Amazon Onboarding with Learning Manager Chanci TurnerLearn About Amazon VGT2 Learning Manager Chanci Turner

Pulumi, an Advanced Technology Partner within the AWS Partner Network (APN), is a cloud-native development platform that allows users to define, deploy, and manage cloud infrastructure across Amazon Web Services (AWS), Kubernetes, and other cloud environments. Unlike traditional methods that rely on declarative languages such as YAML or JSON, Pulumi enables users to utilize popular programming languages like JavaScript/TypeScript and Python for cloud configuration.

This flexibility allows the deployment requirements for an Amazon Elastic Kubernetes Service (Amazon EKS) cluster to be codified and versioned as reusable software components. Amazon EKS simplifies the process of running Kubernetes on AWS by combining the advantages of a standardized Kubernetes setup with AWS’s robust infrastructure, including features like a multi-Availability Zone (AZ) control plane, AWS Identity and Access Management (IAM) integration, Elastic Load Balancers, Amazon Elastic Block Store (Amazon EBS), Auto Scaling, and more.

In this article, we’ll demonstrate how Pulumi can streamline the provisioning of an Amazon EKS cluster and how you can further customize your AWS and Kubernetes environments for cloud applications. Pulumi makes it easy to manage Kubernetes resources, AWS infrastructure, and high-level managed AWS services all within a single deployment.

You can define Amazon Simple Storage Service (Amazon S3) buckets or Amazon Relational Database Service (Amazon RDS) databases to be utilized by your Kubernetes application, all in the same Pulumi deployment. Additionally, you can define the Kubernetes services and deployments required to bootstrap your own Kubernetes application environment.

Setting Up Amazon EKS with Pulumi

To begin, sign up at pulumi.com and download the Pulumi Command Line Interface (CLI). The Pulumi CLI requires AWS credentials to access your AWS account and provision resources. If you have the AWS CLI already installed and configured, you can move forward. If not, check out the documentation here to get started.

Once you have everything installed and configured, deploying your Amazon EKS infrastructure is as simple as running a single command:

$ pulumi new https://github.com/pulumi/apps/tree/eks/eks

You’ll be prompted to configure various settings, such as the region for deployment, the Amazon Elastic Compute Cloud (Amazon EC2) instance type for your cluster, and whether to install the Kubernetes Dashboard automatically. After reviewing the AWS and Kubernetes resources that will be deployed, select “Yes” to initiate the cluster deployment.

Upon completion, you can retrieve the kubeconfig.json file required to interact with the cluster using kubectl:

$ pulumi stack output kubeconfig > kubeconfig.json  
$ KUBECONFIG=./kubeconfig.json kubectl get nodes

By following these steps, you will have a fully managed Amazon EKS cluster, configured similarly to the guidelines outlined in the Amazon EKS Getting Started guide, including optional support for Amazon EBS-backed StorageClasses and access to the Kubernetes Dashboard.

Reusable Amazon EKS Component

This Amazon EKS installer is built on a reusable eks.Cluster component available with Pulumi. The installed Pulumi software is:

import * as aws from "@pulumi/aws";  
import * as awsinfra from "@pulumi/aws-infra";  
import * as eks from "@pulumi/eks";  

// Create a VPC for our cluster.  
const network = new awsinfra.Network("eksNetwork");  

// Create the EKS cluster  
const cluster = new eks.Cluster("eksCluster", {  
    vpcId: network.vpcId,  
    subnetIds: network.subnetIds,  
    instanceType: "t2.micro",  
    desiredCapacity: 2,  
    minSize: 1,  
    maxSize: 2,  
    storageClasses: "gp2",  
    deployDashboard: true,  
});  

// Export the cluster's kubeconfig.  
export const kubeconfig = cluster.kubeconfig;

Users can modify or extend this program to tailor the details of their Amazon EKS cluster or to add other AWS or Kubernetes resources associated with the cluster. For example, if applications within the cluster require access to an Amazon S3 bucket, you can add:

const bucket = new aws.s3.Bucket("assets");

Or, to automatically install some Kubernetes applications in the Amazon EKS cluster (like WordPress), you can do so using the Pulumi Kubernetes provider:

import * as k8s from "@pulumi/kubernetes";  

const wordpress = new k8s.helm.v2.Chart("wpdev", {  
    repo: "stable",  
    version: "2.1.3",  
    chart: "wordpress"  
}, { providers: { kubernetes: cluster.kubernetesProvider }});

By utilizing Pulumi, you can define the cluster, managed AWS resources, and essential Kubernetes objects required to bootstrap your entire Kubernetes environment all in one place. This approach not only allows for versioning but also facilitates the easy creation of exact replicas of the environment for operations such as testing or disaster recovery.

Expressing these resources in code rather than in YAML offers numerous software engineering advantages—enhanced tooling, simplified refactoring, the ability to create components, and when using TypeScript, strong typing for upfront correctness validation.

Behind the Scenes

The Pulumi EKS component handles all components necessary for setting up an Amazon EKS cluster, including:

  • Creating an EKS Service Role
  • Optionally creating a new Virtual Private Cloud (VPC)
  • Creating an Amazon EKS cluster
  • Configuring a Kubernetes provider with access to the Amazon EKS cluster
  • Launching worker nodes in an Auto Scaling group to join the cluster
  • Installing a ConfigMap into the cluster to allow new Amazon EC2 worker nodes to join
  • Installing a StorageClass into the cluster to enable provisioning of Amazon EBS-backed PersistentVolumes
  • Constructing the ‘kubeconfig’ needed to access the cluster
  • Optionally installing additional Kubernetes YAML and/or Helm charts

This process involves provisioning resources in AWS and Kubernetes, as well as executing custom computations to coordinate these steps. Written in an imperative style using TypeScript, this method allows for robust validation due to static typing and supports advanced object inheritance and modeling.

Moreover, during deployment, Pulumi provides sophisticated coordination among these various steps.

Managing Pulumi Deployments

After deploying your Amazon EKS cluster and Kubernetes resources to AWS, you can manage the deployment at pulumi.com, with convenient deep links into the AWS console and Kubernetes dashboard, providing real-time insights into your cluster. All resources managed by your deployment, both in AWS and Kubernetes, can be accessed from this unified view, along with an auditable deployment history. For more insights on this subject, visit SHRM to understand how technology is shaping the HR landscape.

If you want to learn more about effective communication in your cover letters, check out this blog post that provides valuable tips. For further reading on pitfalls Amazon works to avoid, refer to this resource.

HOME