ExamAlert – Provisioning Resources – SOA-C02 Study Guide

ExamAlert

Expect to see at least a handful of CLI questions on the exam. Some of these questions might focus on just the syntax of AWS CLI commands, but there can be some resource-specific questions. If you want to review CLI commands for a specific resource, visit the following reference: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/index.html.

The AWS CLI can be installed on different environments, including MacOS, Linux, Windows, and within Docker containers. Installing the AWS CLI is not an exam objective, so we don’t cover it any further in this book; however, if you want to install the AWS CLI for practice, visit the following site for additional information: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html.

After installing the AWS CLI, you need to configure it so that it can communicate with your AWS environment. This configuration requires information about a user account, including the account access key ID and a secret access key, which is generated while creating the user when choosing the option shown in Figure 7.1.

FIGURE 7.1 Setting the access key ID and secret access key

To configure the AWS CLI after installing, execute the aws configure command as follows:

Click here to view code image

$ aws configure

AWS Access Key ID [None]:

<insert Access Key ID here>

AWS Secret Access Key [None]:

<insert Secret Access Key ID here>

Default region name [None]:

<insert region name, like us-west-1, here>

Default output format [None]:

<insert output format here; json is most

common>

To understand the basic syntax of an AWS CLI command, consider the following example:

Click here to view code image

aws ec2 terminate-instances –instance-ids

<id>

The command syntax breaks down into these different components:

aws: All AWS CLI commands start with aws.

ec2: This is called the AWS command or top-level command. Typically, it is associated with an AWS service or resource—ec2 in this case.

terminate-instances: This is called the subcommand. Each AWS command has subcommands that further define the action to take. In this example, the terminate-instances command is designed to terminate one or more instances that are currently running.

–instance-ids: This is an option to the command. Options are specific to the command or subcommand. In this example, the option –instance-ids is used to indicate which instances are to be terminated.

<id>: This is the argument that corresponds with the previous option. In this example, <id> would be replaced with one or more EC2 instance IDs before actually running this command.

ExamAlert

There are hundreds of aws ec2 subcommands, too many to memorize for the exam. If you are asked any questions that are specific to aws ec2 subcommands, they will likely be about listing, launching, or terminating EC2 instances. Consider reviewing the following short guide before taking the exam to become familiar with these subcommands: https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-instances.html.