Sub topic 1
Three ways to work with AWS
Prerequisites
This chapter assumes you have the following:
- A basic idea of what AWS is and what a cloud service is.
- Comfort running shell commands in a terminal.
- An AWS account, and a sign-in with permission to view resources.
- Some awareness of JSON as a data format.
You don't need to install anything yet. Later chapters cover installation and configuration step by step.
One API, three front ends
Every action in AWS is an API call. Creating a bucket, starting an instance, and reading a log group are all HTTPS requests to a service endpoint in a particular Region. Each request is signed with credentials that identify who is calling. AWS checks the signature, then checks whether that identity's policies allow the action.
The Management Console, the AWS CLI, and AWS CloudShell are three ways to build and send those requests by hand:
- The AWS Management Console is a web application. You click through pages, and the console makes API calls for you.
- The AWS CLI (command line interface) is a program on your own computer. You type commands, and it turns each one into an API call.
- AWS CloudShell is a browser-based shell that you start from the Console. It runs the AWS CLI in a managed environment that AWS hosts.
Because all three go through the same APIs, they share the same permissions model. If a policy denies an action in the Console, it denies the same action in the CLI. The reverse also holds. Differences between the tools come from how you authenticate, where the tool runs, and how convenient it is for a given task.
The Management Console
The Console is the visual front end at the AWS website. You sign in with a root user, an IAM user, or an identity from IAM Identity Center. The next chapters cover these identity types. After sign-in, the Console holds temporary credentials for your session and uses them for every page you open.
The Console works well for these jobs:
- Exploring. You can browse a service you haven't used and see what options exist, with descriptions and validation built into the forms.
- Visual inspection. Dashboards, graphs, and relationship views are easier to read than raw JSON.
- One-off changes. For a single change you won't repeat, clicking is often the fastest route.
- Account-level tasks. Billing pages and account settings are most often managed there.
The Console has costs too. Clicks are hard to repeat exactly, hard to review, and hard to put in version control. Two people following the same written steps can end up with different results, because a field was missed or a Region was wrong.
The AWS CLI
The AWS CLI is a single program, aws, that you install on your laptop, a build server, or another machine. Version 2 is the current major version, and this tutorial uses it throughout. You can confirm what you have with:
aws --versionThe output starts with aws-cli/2. followed by the exact version. It also shows the Python build and operating system the CLI was packaged with, so those details differ between machines.
Unlike the Console, the CLI doesn't sign you in through a web page. It looks for credentials in a defined order. These sources include command-line options, environment variables, and the shared config and credentials files in ~/.aws. Named profiles in those files let you switch between accounts and roles. Because you control where the credentials come from, you are responsible for keeping them safe.
The CLI works well for these jobs:
- Repeatable work. A command can be copied, reviewed, and put in a script.
- Bulk operations. One loop can touch hundreds of resources.
- Precise output. You can filter results and pipe them into other tools.
- Automation. The same commands run in build pipelines and scheduled jobs.
The CLI has costs as well. You have to install and update it, set up credentials correctly, and learn its command structure. A mistake in a script can change many resources quickly, so it also helps to know about preview options such as --dryrun on S3 commands.
AWS CloudShell
CloudShell sits between the other two. You open it from the Console, normally with the terminal icon in the top navigation bar. A shell session then starts in a new browser pane. The AWS CLI is already installed, and you don't configure credentials, because CloudShell uses the credentials of the identity you signed in to the Console with.
CloudShell has these properties:
- No setup. There is nothing to install and no access key to create. This removes the need for long-lived keys on your own machine.
- Same identity as the Console. Commands run with your Console session's permissions. Check with
aws sts get-caller-identityif you are unsure who you are acting as. - Region-scoped. A CloudShell environment belongs to the Region you opened it in. CloudShell is also not offered in every Region.
- Persistent home directory. Files under your home directory are kept between sessions, up to a quota of about 1 GB per Region. Files outside the home directory are lost when the session ends.
- Session limits. Sessions end after a period of inactivity, so don't rely on a long-running process surviving.
- Its own permissions. Your identity needs permission to use CloudShell itself. AWS provides a managed policy for this purpose.
The CloudShell chapters cover storage, preinstalled tools, and file transfer in detail.
Comparing the three
| Aspect | Management Console | AWS CLI | AWS CloudShell |
|---|---|---|---|
| Where it runs | Your browser | Your machine or server | A managed environment, in your browser |
| Interface | Graphical pages | Commands and text output | Commands and text output |
| Setup required | None beyond sign-in | Install, then configure credentials | None beyond Console sign-in |
| Where credentials come from | Your Console sign-in | Profiles, environment variables, config files | Your Console sign-in |
| Repeatability | Low | High | High, for the commands you save |
| Works offline from the Console | No | Yes, given network access to AWS | No |
| Best for | Exploring, visual checks, one-off changes | Automation, bulk work, pipelines | Quick commands with no local setup |
How the three fit together
You rarely pick one tool for good. A common workflow looks like this:
- Explore a new service in the Console to learn its concepts and settings.
- Try a few read-only commands in CloudShell to see the data in text form.
- Move the commands you want to keep to your own machine with the CLI, and put them in a script.
CloudShell also helps when your own machine is a poor fit. You might be on a locked-down computer, or you might want a clean, known environment to reproduce a problem.
Two habits apply no matter which tool you use. First, check which account and Region you are acting in before you change anything. The Console shows the Region in its navigation bar, and the CLI takes it from the profile, an environment variable, or a --region option. Second, prefer read-only commands while you are learning.
What comes next
The rest of the tutorial follows the order in which you will use these tools. The next chapter covers accounts, Regions, and identities, because every sign-in method depends on them. After that come the Console, then installing and configuring the CLI. CloudShell, secure access practices, and troubleshooting follow. The last chapter returns to the question of choosing the right tool for the task.
Exercise
A teammate says, "The CLI can do things the Console can't, because the Console is restricted by policies and the CLI isn't." What is wrong with this claim, and what usually explains a command that works in one tool but fails in the other?
Show answer
Both tools send signed requests to the same service APIs, and the same IAM policies apply to both, so neither bypasses permissions. A difference in results usually comes from acting as a different identity (for example a different profile or role), working in a different Region, or targeting a different account. Verify with the active identity and Region in each tool before looking elsewhere.
Exercise
You need to run three read-only commands once, on a borrowed computer where you can't install software and don't want to store access keys. Which tool fits best, and which credentials does it use?
Show answer
AWS CloudShell fits best. It is launched from the Console in the browser, comes with the AWS CLI preinstalled, and uses the credentials of the identity you signed in to the Console with, so no local install or stored access key is needed.