<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Christopher Vensand</title>
    <description>The latest articles on DEV Community by Christopher Vensand (@chrisvensand).</description>
    <link>https://dev.to/chrisvensand</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2630784%2Faed8b141-6c26-410f-a1f9-7f7444fa7f70.jpeg</url>
      <title>DEV Community: Christopher Vensand</title>
      <link>https://dev.to/chrisvensand</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chrisvensand"/>
    <language>en</language>
    <item>
      <title>Deploying Your First Kubernetes Cluster on AWS Using EKS</title>
      <dc:creator>Christopher Vensand</dc:creator>
      <pubDate>Mon, 06 Jan 2025 05:25:01 +0000</pubDate>
      <link>https://dev.to/chrisvensand/deploying-your-first-kubernetes-cluster-on-aws-using-eks-3g38</link>
      <guid>https://dev.to/chrisvensand/deploying-your-first-kubernetes-cluster-on-aws-using-eks-3g38</guid>
      <description>&lt;p&gt;Welcome to the second post in my series, &lt;a href="https://dev.to/chrisvensand/building-internet-scale-services-with-kubernetes-and-aws-4718"&gt;Building Internet Scale Services with Kubernetes and AWS&lt;/a&gt;. If you're new to Kubernetes or AWS, I recommend going back and reading the &lt;a href="https://dev.to/chrisvensand/building-internet-scale-services-with-kubernetes-and-aws-4718"&gt;first post&lt;/a&gt; for foundational knowledge about these technologies.&lt;/p&gt;

&lt;p&gt;In this post, I'll walk you through creating your first Kubernetes cluster in AWS using EKS (Elastic Kubernetes Service). We’ll use &lt;a href="https://www.terraform.io/" rel="noopener noreferrer"&gt;Terraform&lt;/a&gt; to provision the infrastructure, ensuring we can easily modify or recreate our setup whenever needed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Use Terraform?
&lt;/h2&gt;

&lt;p&gt;Terraform allows you to define your infrastructure in code and then provision it across different platforms. For example, you might want a Kubernetes cluster in AWS for your core applications, a database in GCP for specialized features, and an object store in Azure. Using Terraform, you can define all of these resources in a unified set of files making multi-cloud architectures simpler to manage.&lt;/p&gt;

&lt;p&gt;If you relied entirely on the AWS Console (the web interface) to create your infrastructure, you would have to click the same sequence of buttons every time you wanted to recreate your setup. With Terraform, you can simply run your code again. This “infrastructure as code” approach is a powerful way to maintain and scale your infrastructure.&lt;/p&gt;




&lt;h2&gt;
  
  
  Setting Up an AWS Account
&lt;/h2&gt;

&lt;p&gt;Before provisioning any infrastructure, you’ll need an AWS account. The easiest way to do this is through the AWS Console. Head over to the &lt;a href="https://signin.aws.amazon.com/signup?request_type=register" rel="noopener noreferrer"&gt;AWS sign-up page&lt;/a&gt; and create your account.&lt;/p&gt;




&lt;h2&gt;
  
  
  Creating an IAM User
&lt;/h2&gt;

&lt;p&gt;Once your AWS account is created, you'll need to create an IAM (Identity and Access Management) user whose credentials Terraform will use to provision your infrastructure.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the AWS Console, type &lt;strong&gt;IAM&lt;/strong&gt; in the search bar at the top and select the &lt;strong&gt;IAM&lt;/strong&gt; service.
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Users&lt;/strong&gt; under &lt;strong&gt;Access management&lt;/strong&gt; on the left panel.
&lt;/li&gt;
&lt;li&gt;Since you likely won't have any users yet, click &lt;strong&gt;Create user&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Choose any username you like.
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Set permissions&lt;/strong&gt;, click &lt;strong&gt;Attach policies directly&lt;/strong&gt; and select &lt;strong&gt;AdministratorAccess&lt;/strong&gt;.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Note:&lt;/strong&gt; In a production environment, you should grant only the minimum permissions needed rather than full administrative privileges. However, for simplicity in this tutorial, we’ll use AdministratorAccess.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Review your settings and click &lt;strong&gt;Create user&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Generating AWS Access Keys
&lt;/h2&gt;

&lt;p&gt;Next, you’ll need to create an Access Key for this IAM user. Terraform will use these credentials to communicate with your AWS account.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on your newly created user.
&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Security credentials&lt;/strong&gt; tab.
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Access keys&lt;/strong&gt;, click &lt;strong&gt;Create access key&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;Use case&lt;/strong&gt;, choose &lt;strong&gt;Command Line Interface (CLI)&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Follow the prompts, then click &lt;strong&gt;Create access key&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Important:&lt;/strong&gt; Copy or download the Access Key and Secret Access Key. You will not be able to view the Secret Access Key again once you close this window. If lost, you’ll have to create a new key.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That’s all you need from the AWS Console for now!&lt;/p&gt;




&lt;h2&gt;
  
  
  Setting Up Your Terminal
&lt;/h2&gt;

&lt;p&gt;Now that you’ve created your IAM user and obtained your AWS access keys, it’s time to install the command-line tools needed to provision your Kubernetes cluster. You’ll need to install and configure two essential CLIs: the AWS CLI and Terraform.&lt;/p&gt;

&lt;h3&gt;
  
  
  macOS
&lt;/h3&gt;

&lt;p&gt;Install &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;Homebrew&lt;/a&gt; and run the following commands in your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;awscli terraform
aws &lt;span class="nt"&gt;--version&lt;/span&gt;
terraform &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Other Platforms
&lt;/h3&gt;

&lt;p&gt;If you’re using Windows or Linux, refer to the official documentation for installation details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Windows&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#windows" rel="noopener noreferrer"&gt;AWS CLI Installation Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.terraform.io/downloads" rel="noopener noreferrer"&gt;Terraform Download Page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Linux&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#install-bundle-linux" rel="noopener noreferrer"&gt;AWS CLI Installation Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.terraform.io/downloads" rel="noopener noreferrer"&gt;Terraform Download Page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Configuring the AWS CLI
&lt;/h3&gt;

&lt;p&gt;Once both CLIs are installed, configure the AWS CLI to use the credentials you obtained earlier by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When prompted, enter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Access Key ID&lt;/strong&gt;: Your IAM user’s access key.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Secret Access Key&lt;/strong&gt;: Your IAM user’s secret key.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default region name&lt;/strong&gt; (e.g., &lt;code&gt;us-east-1&lt;/code&gt;, &lt;code&gt;us-west-2&lt;/code&gt;): Your preferred AWS region.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default output format&lt;/strong&gt; (e.g., &lt;code&gt;json&lt;/code&gt;): The output format for CLI commands.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your system is now ready to interface directly with AWS through the command line!&lt;/p&gt;




&lt;h2&gt;
  
  
  Understanding the Terraform Code
&lt;/h2&gt;

&lt;p&gt;With your environment set up, let’s clone the repository and review how the Terraform files work together to provision your Kubernetes cluster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/chrisvensand/terraform-aws-eks
&lt;span class="nb"&gt;cd &lt;/span&gt;terraform-aws-eks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside this repository, you’ll find three main Terraform files—&lt;strong&gt;main.tf&lt;/strong&gt;, &lt;strong&gt;provider.tf&lt;/strong&gt;, and &lt;strong&gt;versions.tf&lt;/strong&gt;—that define your AWS and EKS resources. Below is a breakdown of what each file does:&lt;/p&gt;

&lt;h3&gt;
  
  
  main.tf
&lt;/h3&gt;

&lt;p&gt;This file contains the core configurations for your VPC (networking) and EKS cluster. It references publicly available Terraform modules to simplify the setup:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;VPC Module&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;   &lt;span class="nx"&gt;module&lt;/span&gt; &lt;span class="s2"&gt;"vpc"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;source&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"terraform-aws-modules/vpc/aws"&lt;/span&gt;
     &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"my-eks-cluster-vpc"&lt;/span&gt;
     &lt;span class="nx"&gt;cidr&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.0.0/16"&lt;/span&gt;

     &lt;span class="nx"&gt;azs&lt;/span&gt;             &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_availability_zones&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;available&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;names&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="nx"&gt;public_subnets&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"10.0.1.0/24"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"10.0.2.0/24"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
     &lt;span class="nx"&gt;private_subnets&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"10.0.3.0/24"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"10.0.4.0/24"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

     &lt;span class="nx"&gt;enable_nat_gateway&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
     &lt;span class="nx"&gt;single_nat_gateway&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
     &lt;span class="nx"&gt;enable_dns_hostnames&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
     &lt;span class="nx"&gt;enable_dns_support&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;source&lt;/strong&gt;: Uses the &lt;a href="https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest" rel="noopener noreferrer"&gt;terraform-aws-modules/vpc/aws&lt;/a&gt; module, which wraps all the AWS VPC resources (VPC, subnets, NAT gateways, etc.) in an easy-to-use package.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CIDR&lt;/strong&gt;, &lt;strong&gt;public_subnets&lt;/strong&gt;, &lt;strong&gt;private_subnets&lt;/strong&gt;: Define the IP address ranges for your VPC. The public subnets are accessible from the internet, while the private subnets are reserved for internal traffic (where your EKS worker nodes will typically reside).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;enable_nat_gateway&lt;/strong&gt; and &lt;strong&gt;single_nat_gateway&lt;/strong&gt;: Provision a NAT gateway for secure outbound internet traffic from private subnets.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;enable_dns_hostnames&lt;/strong&gt; and &lt;strong&gt;enable_dns_support&lt;/strong&gt;: Enable DNS for resources in your VPC, allowing you to map IP addresses to DNS names.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;EKS Module&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;   &lt;span class="nx"&gt;module&lt;/span&gt; &lt;span class="s2"&gt;"eks"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;source&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"terraform-aws-modules/eks/aws"&lt;/span&gt;
     &lt;span class="nx"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 20.31"&lt;/span&gt;

     &lt;span class="nx"&gt;cluster_name&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"my-eks-cluster"&lt;/span&gt;
     &lt;span class="nx"&gt;cluster_version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1.31"&lt;/span&gt;

     &lt;span class="nx"&gt;enable_cluster_creator_admin_permissions&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

     &lt;span class="nx"&gt;cluster_compute_config&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="nx"&gt;enabled&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
       &lt;span class="nx"&gt;node_pools&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"general-purpose"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;

     &lt;span class="nx"&gt;vpc_id&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;vpc_id&lt;/span&gt;
     &lt;span class="nx"&gt;subnet_ids&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;private_subnets&lt;/span&gt;

     &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="nx"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"dev"&lt;/span&gt;
       &lt;span class="nx"&gt;Terraform&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;source&lt;/strong&gt;: Leverages the &lt;a href="https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest" rel="noopener noreferrer"&gt;terraform-aws-modules/eks/aws&lt;/a&gt; module. This module takes care of creating the EKS control plane, node groups, and associated IAM roles.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;cluster_name&lt;/strong&gt; and &lt;strong&gt;cluster_version&lt;/strong&gt;: Specify the name and Kubernetes version for your cluster.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;enable_cluster_creator_admin_permissions&lt;/strong&gt;: Grants the user deploying the cluster (i.e., your AWS account credentials) full administrative access to the cluster.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;cluster_compute_config&lt;/strong&gt;: Configures how node groups are created, naming them and selecting instance types or node pool strategies.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;vpc_id&lt;/strong&gt; and &lt;strong&gt;subnet_ids&lt;/strong&gt;: Tie the EKS cluster into the VPC created in the &lt;code&gt;vpc&lt;/code&gt; module, ensuring the cluster resides in private subnets.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;tags&lt;/strong&gt;: Attach key-value tags to your EKS resources for easy tracking and organization.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Data Source: aws_availability_zones&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;   &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_availability_zones"&lt;/span&gt; &lt;span class="s2"&gt;"available"&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Fetches the list of available AWS Availability Zones in your chosen region. The VPC module references this data to build out the subnets in two of those zones (ensuring high availability).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  provider.tf
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;region&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-west-2"&lt;/span&gt;
  &lt;span class="nx"&gt;profile&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;region&lt;/strong&gt;: Specifies the default AWS region (in this case, &lt;code&gt;us-west-2&lt;/code&gt;) where Terraform will provision your resources.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;profile&lt;/strong&gt;: Defines the AWS CLI profile to use. If you’ve already configured your &lt;code&gt;~/.aws/credentials&lt;/code&gt;, specifying &lt;code&gt;default&lt;/code&gt; means Terraform will use that profile’s credentials.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  versions.tf
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;terraform&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;required_version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&amp;gt;= 1.3.0"&lt;/span&gt;
  &lt;span class="nx"&gt;required_providers&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;aws&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;source&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"hashicorp/aws"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;required_version&lt;/strong&gt;: Ensures you’re running Terraform v1.3.0 or later.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;required_providers&lt;/strong&gt;: Declares which providers are needed (in this case, &lt;code&gt;aws&lt;/code&gt;) and where Terraform should download them from (the HashiCorp registry).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Finally, Deploying Your EKS Cluster
&lt;/h2&gt;

&lt;p&gt;All set! You’ve done a lot of preparation, but for a fully managed, infinitely scalable Kubernetes cluster, the setup is actually pretty streamlined. Here’s how to deploy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Initialize Terraform&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This downloads any required plugins or modules.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Apply your infrastructure&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terraform will display a plan, detailing every resource it intends to create. Review and confirm to kick off the deployment.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This can take around 10 minutes, so be patient. Terraform will keep you updated on progress.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the deployment finishes, head to the &lt;strong&gt;EKS&lt;/strong&gt; page in the AWS Console. You should see your brand-new cluster ready to roll! Give yourself a well-deserved pat on the back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability Note:&lt;/strong&gt; An EKS cluster can scale to 1,000 nodes (and even beyond, if you request a limit increase from AWS). This should be more than enough capacity for most use cases. If you truly need global presence, you can reuse these same Terraform configurations in additional AWS regions worldwide—just change the &lt;code&gt;region&lt;/code&gt; in your provider settings.&lt;/p&gt;




&lt;h2&gt;
  
  
  What’s Next?
&lt;/h2&gt;

&lt;p&gt;In the next blog post, we’ll build a simplified version of “Netflix” on our new Kubernetes cluster, exploring how to run and manage a more complex, microservices-style application. With your EKS cluster in place, the sky’s the limit!&lt;/p&gt;

&lt;p&gt;Feel free to drop any questions or comments below. I hope this tutorial empowers you to spin up scalable, resilient Kubernetes clusters on AWS with Terraform—happy building!&lt;/p&gt;




&lt;h3&gt;
  
  
  About Me
&lt;/h3&gt;

&lt;p&gt;I previously worked at Riot Games as a software engineer on the infrastructure team. While there, I helped the company transition from on-premises infrastructure to AWS and optimized backend services for games like Valorant and League of Legends, running on Kubernetes clusters worldwide.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>kubernetes</category>
      <category>terraform</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Building Internet Scale Services with Kubernetes and AWS</title>
      <dc:creator>Christopher Vensand</dc:creator>
      <pubDate>Mon, 30 Dec 2024 03:11:17 +0000</pubDate>
      <link>https://dev.to/chrisvensand/building-internet-scale-services-with-kubernetes-and-aws-4718</link>
      <guid>https://dev.to/chrisvensand/building-internet-scale-services-with-kubernetes-and-aws-4718</guid>
      <description>&lt;p&gt;The services we enjoy everyday—like YouTube, Netflix, and online games—operate at an incredible scale, handling millions (or even billions) of users seamlessly. Behind the scenes, technologies like Kubernetes and AWS make this possible by enabling developers to deploy, manage, and scale applications reliably across the globe.&lt;/p&gt;

&lt;p&gt;This blog series will walk you through what &lt;a href="https://kubernetes.io/" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt; and &lt;a href="https://aws.amazon.com/" rel="noopener noreferrer"&gt;Amazon Web Services (AWS)&lt;/a&gt; are, how they complement each other, and how you can use them to build internet-scale applications. &lt;strong&gt;Part 0&lt;/strong&gt; (this post) will introduce the basics. Future posts will include boilerplate code to help you set up your own Kubernetes cluster in AWS and practical examples of building scalable services. Onward!&lt;/p&gt;




&lt;h3&gt;
  
  
  What Do We Mean by Internet-Scale?
&lt;/h3&gt;

&lt;p&gt;When I say “internet scale,” I’m referring to services accessed by millions—or even billions—of people every month. Think YouTube, Netflix, Reddit, or Wikipedia. These platforms operate at a scale that’s hard to imagine.&lt;/p&gt;

&lt;p&gt;To put it in perspective:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.statista.com/chart/15692/distribution-of-global-downstream-traffic/" rel="noopener noreferrer"&gt;Netflix accounted for roughly 15% of all internet traffic in 2022&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;In the United States alone, Netflix viewers spent &lt;a href="https://www.statista.com/statistics/1307991/time-spent-viewing-netflix-worldwide-country-origin/" rel="noopener noreferrer"&gt;16.3 billion hours&lt;/a&gt; watching content. That’s the equivalent of 23,254 human lifetimes!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Building infrastructure capable of supporting this scale requires advanced tools—and that’s where Kubernetes and AWS shine.&lt;/p&gt;




&lt;h3&gt;
  
  
  Why Kubernetes and AWS?
&lt;/h3&gt;

&lt;p&gt;So how do Kubernetes and AWS make internet-scale services possible? Services that handle traffic at this scale can’t rely on just one server to deliver the smooth experiences we’re all used to. A single server would be overwhelmed, and even multiple servers wouldn’t suffice if they aren’t distributed globally. Without global distribution, users far from the servers would experience lag, downtime, or other issues.&lt;/p&gt;

&lt;p&gt;This is where Kubernetes and AWS step in. Kubernetes ensures your applications run efficiently across thousands of servers, while AWS provides the global infrastructure and managed services needed to host and scale these applications seamlessly.&lt;/p&gt;




&lt;h3&gt;
  
  
  Kubernetes at a Glance
&lt;/h3&gt;

&lt;p&gt;Kubernetes is an open-source &lt;strong&gt;container orchestration system&lt;/strong&gt; for automating software deployment, scaling, and management.&lt;/p&gt;

&lt;p&gt;But what does that really mean?&lt;/p&gt;

&lt;p&gt;Let’s break it down: Kubernetes automates many of the hard parts of running software on thousands of servers. It’s called a "container orchestration system" because it expects your software to be packaged into containers. A container is a lightweight bundle that includes your software and everything it needs to run—such as its operating system dependencies and environment variables.&lt;/p&gt;

&lt;p&gt;Imagine you’re running multiple restaurants, and each one has different menus, staff, and hours of operation. Kubernetes acts like a central manager, making sure each restaurant (server) runs efficiently and has exactly what it needs. It assigns tasks, scales resources up or down depending on demand, and ensures nothing falls through the cracks.&lt;/p&gt;

&lt;p&gt;A group of servers managed by Kubernetes is called a &lt;strong&gt;cluster&lt;/strong&gt;. These clusters allow you to run applications reliably at massive scale. For example, the largest reported Kubernetes cluster belongs to &lt;a href="https://jd.com" rel="noopener noreferrer"&gt;JD.com&lt;/a&gt;, a major Chinese retailer, and it &lt;a href="https://kubernetes.io/case-studies/jd-com/" rel="noopener noreferrer"&gt;runs on tens of thousands of servers&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;While Kubernetes handles the management of your applications, it still needs the underlying infrastructure to run on. This is where AWS comes in.&lt;/p&gt;




&lt;h3&gt;
  
  
  AWS at a Glance
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/" rel="noopener noreferrer"&gt;AWS&lt;/a&gt; (Amazon Web Services) is one of the leading cloud computing platforms, providing on-demand resources like compute power, storage, and networking. It’s designed to support everything from small personal projects to large-scale, highly available enterprise applications.&lt;/p&gt;

&lt;p&gt;But what does this actually mean? Remember the servers we’ve been talking about? These are physical machines that need to be housed somewhere, maintained, and regularly upgraded. Managing these machines yourself would require a massive investment in data centers, IT staff, and maintenance schedules—not to mention ensuring reliability and uptime. AWS simplifies this process by managing the servers for you and charging you only for what you use.&lt;/p&gt;

&lt;p&gt;Some of the most relevant AWS services include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EC2 (Elastic Compute Cloud):&lt;/strong&gt; Virtual machines in the cloud that scale up or down depending on demand.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon S3 (Simple Storage Service):&lt;/strong&gt; A highly scalable and durable storage service for any type of data.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EKS (Elastic Kubernetes Service):&lt;/strong&gt; A managed Kubernetes service that takes care of provisioning, scaling, and maintaining Kubernetes clusters on AWS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this blog series, we’ll focus on &lt;strong&gt;EKS&lt;/strong&gt;, as it’s the service that bridges Kubernetes and AWS. EKS automates much of the work required to set up and manage Kubernetes clusters, making it easier to deploy and scale your applications globally. With AWS’s global infrastructure, you can run your applications closer to users around the world, ensuring faster response times and a better user experience.&lt;/p&gt;




&lt;h3&gt;
  
  
  Next Steps
&lt;/h3&gt;

&lt;p&gt;Kubernetes and AWS are a powerful combination for building internet-scale services. Kubernetes provides the tools to manage applications efficiently across thousands of servers, while AWS offers the underlying infrastructure to support these applications globally.&lt;/p&gt;

&lt;p&gt;In the next post, we’ll dive into some Terraform code for setting up your own Kubernetes cluster on AWS!&lt;/p&gt;

&lt;p&gt;Part 1: &lt;a href="https://dev.to/chrisvensand/deploying-your-first-kubernetes-cluster-on-aws-using-eks-3g38"&gt;Deploying Your First Kubernetes Cluster on AWS Using EKS&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  About Me
&lt;/h3&gt;

&lt;p&gt;I previously worked at Riot Games as a software engineer on the infrastructure team. While there, I helped the company transition from on-premises infrastructure to AWS and optimized backend services for games like Valorant and League of Legends, running on Kubernetes clusters worldwide.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>aws</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
