The AWS Command Line Interface (CLI)
The AWS CLI is a great command-line tool that allows you to interface with AWS technology such as S3 buckets, interacting with EC2 instances and others. We will start to see actual use cases of implementing the AWS CLI in more depth in Chapter 4, Exploiting S3 Buckets. The AWS CLI is a great way to learn and get comfortable with using a terminal-like interface because it allows you to interact with everything in your AWS environment. For pentesting, it's always good to be comfortable with using a command line and/or a terminal because you never know when a GUI just won't do the trick. Imagine being in the middle of a penetration test and your tool interface freezes, or the frontend of an application throws an error and ceases to work. This is where understanding the command line proves to be beneficial.
Installing the AWS CLI
Now we will need to move forward and install the AWS CLI on our Kali Linux machine. This will be the command line we will use throughout this book to interact with our AWS environment:
- To begin, let's check and see if the AWS CLI is already installed on our machines:
$ aws --version
- If you have an old version, you should see what version you have. If you haven't used it in a while, it's best to go ahead and reinstall it:
$ apt-get remove awscli -y $ apt-get install awscli -y
- Double-check to ensure that your command-line interface successfully installed by running the
--version
switch again.
Now your host is set up to interact with resources in AWS and cover the material in this book. Feel free to play around and get comfortable with the command-line interface. It's something that you'll need to get used to as you go through this book and interact with AWS in the real world.
Exploring basic AWS CLI commands
Now we will look at some basic AWS CLI commands, now that there is a general understanding of what the AWS CLI is and how it works. The following shows a few commands that you'll see throughout this book. These commands are meant to interact with various services, such as S3, EC2, and Lambda.
Once you've configured your AWS CLI, use the following command to get a list of commands:
$ aws help
The following command is useful to describe the attributes of an EC2 server:
$ aws ec2 describe instance
The next command will list out the buckets in an S3 environment:
$ aws s3 ls s3://
The last command we will mention is used to list out functions with Lambda:
$ aws lambda list-functions –-region <<region>>
As you can see, there are quite a few services that you can interact with via the AWS CLI. You'll become more and more familiar with interacting with these services as we continue to go through more exercises in this book. Now that we have discussed the last topic in this chapter, let's wrap up and recap!