top of page

How to Build Your First DevOps Lab with AWS CLI – Part 1

The New Norm: DevOps and Cloud

DevOps is part of every modern IT organization. Cloud is part of every modern IT organization. Combine those two facts, and you realize you need to know DevOps and cloud to advance your career. And to truly understand them, you need hands-on experience.


In this four-part blog series, you will get exactly that: hands-on experience and knowledge of how DevOps works in the cloud.

I will walk you through step-by-step to build out a DevOps lab of your own in one of the most popular cloud infrastructure environments: Amazon Web Services (AWS). We will leverage AWS EC2 (Elastic Cloud Compute) to implement Jenkins and Ansible running in Docker containers. (Don’t worry! We’ll get what Jenkins, Ansible, and Docker are later in the series.)


In this article (Part 1) we will set the foundation to build out your lab by explaining some background information and setting up the AWS CLI (Command Line Interface).


What is the AWS CLI?

Amazon Web Services Command Line Interface (AWS CLI) is a powerful tool. It allows you to deploy and configure AWS services all from the command line. The AWS CLI can manage, administer, and access functions in the AWS Management Console by leveraging the public AWS APIs (Application Programming Interface). The AWS CLI will work on Windows, Mac, and Linux, allowing it to be used on virtually any device.


Being able to configure AWS services from the command line means that all actions can be automated with scripts as well. The AWS CLI is a straightforward tool that has some great references if you ever get stuck on the syntax; the references can be found here.


Getting Started

If it wasn’t already clear, before we start anything, you will need to have an Amazon account. You can either use an existing Amazon account or create a new one specifically for cloud services. The following sections will guide you through creating two Amazon Elastic Cloud Compute (EC2) t2.micro machines that will host the DevOps components. There will also be configurations needed on each of those machines to be able to integrate some of the components.


Setting Up the AWS CLI

Step 1: Create an Access Key

The first thing that you will need to do is create an Access Key. This allows the AWS CLI to login to your Amazon account without needing your username and password. Instead, it uses the values generated inside the key. This is more secure than using your username and password as these values are stored in a file on your local machine when you initially configure the AWS CLI.


To create the Access Key, follow these steps:

1. Navigate to https://console.aws.amazon.com/iam/home#/home and sign in if not already.

2. On the right, under Quick Link, click My access key.



3. From the screen that follows, click Create New Access Key.


4. You will get a popup, select Download Key File. This will give you a CSV (comma-delimited) file with the necessary information to configure the AWS CLI.


Step 2: Install the AWS CLI

After obtaining the Access Key, the next step would be to install the AWS CLI. Python is needed to install the AWS CLI, so make sure you have a supported version. More information can be found here.


For my configuration, I created a virtual environment to keep this configuration separate from others, though this is not necessary.


Follow these steps to get the AWS CLI installed and configured:


1. Install AWS CLI

Command

python -m pip install awscli

2. Configure Credentials


Command

aws configure

3. Input the required information.


The Access Key ID and Secret Access Key can be found in the CSV file obtained earlier. If you are unsure what region you are in, you can always look in the AWS Management Console next to your name in the upper right corner.


What's Next?

In short, a lot! In the grand scheme of things, it isn’t too difficult, but it does take some time. If you are interested in learning more about how to configure a DevOps lab and being able to get hands-on experience with the finished product, stick with me! There’s more to come!


Still have questions or want to discuss DevOps, Automation, or Cloud further? Setup a meeting with us to see how we can help by clicking here.

bottom of page