Preparing for the Cluster Setup: AWS CLI and Region
In this lesson, we will start preparing for the setup of our production ready cluster by setting up AWS CLI and default region environment variable.
We'll cover the following
Setting Up AWS CLI#
We’ll continue using the specifications from the vfarcic/k8s-specs
repository, so the first thing we’ll do is to clone and go inside the directory.
We will assume that you already have an AWS account. If that’s not the case, please head over to Amazon Web Services and sign-up.
ℹ️ If you are already proficient with AWS, you might want to skim through the text that follows and only execute the commands.
The first thing we should do is get the AWS credentials.
Please open Amazon EC2 Console, click on your name from the top-right menu and select My Security Credentials. You will see the screen with different types of credentials. Expand the Access Keys (Access Key ID and Secret Access Key) section and click the Create New Access Key button. Expand the Show Access Key section to see the keys.
You will not be able to view the keys later on, so this is the only chance you’ll have to Download Key File.
We’ll put the keys as environment variables that will be used by the AWS Command Line Interface (AWS CLI).
Please replace [...]
with your keys before executing the commands that follow.
We’ll need to install AWS Command Line Interface (CLI) and gather info about your account.
If you haven’t already, please open the Installing the AWS Command Line Interface page, and follow the installation method best suited for your OS.
📝 A Couple of notes to Windows users#
We found the most convenient way to get AWS CLI installed on Windows is to use Chocolatey. Download and install Chocolatey, then run
choco install awscli
from an Administrator Command Prompt. Later on in the chapter, Chocolatey will be used to install jq.You might need to reopen your GitBash terminal for the changes to the environment variable
PATH
to take effect.
Once you’re done, we’ll confirm that the installation was successful by outputting the version.
The output is as follows.
Defining the Region#
Amazon EC2 is hosted in multiple locations worldwide. These locations are composed of regions and availability zones. Each region is a separate geographic area composed of multiple isolated locations known as availability zones. Amazon EC2 provides you the ability to place resources, such as instances, and data in multiple locations.
Next, we’ll define the environment variable AWS_DEFAULT_REGION
that will tell AWS CLI which region we’d like to use by default.
For now, please note that you can change the value of the variable to any other region, as long as it has at least three availability zones. We’ll discuss the reasons for using us-east-2
region and the need for multiple availability zones soon.
In the next lesson, we will continue to prepare for the cluster setup by creating IAM (Identity and Access Management) resources and users.