Sub topic 16
Choosing the right tool for the task
This chapter assumes you have used all three tools at least once. You should be able to sign in to the Console, run aws commands with a configured profile, and open CloudShell. Here you compare them and decide which one fits a given task.
The three tools reach the same APIs
The Console, the AWS CLI, and CloudShell all call the same AWS service APIs. A bucket created in the Console is the same bucket the CLI lists. The tools differ in how you authenticate, how repeatable your work is, and where your commands run.
| Dimension | Management Console | AWS CLI v2 (local) | AWS CloudShell |
|---|---|---|---|
| Interface | Browser, point and click | Terminal on your machine | Browser-based shell |
| Setup | None beyond sign-in | Install, configure profiles, sign in | None, launched from the Console |
| Credentials | Your console sign-in session | Profiles, environment variables, SSO cache | Inherited from your console identity |
| Repeatability | Low, manual steps | High, commands can be saved and scripted | High within the session |
| Local files | Browser upload and download only | Full access to your file system | Own 1 GB home directory, transfer by upload and download |
| Best at | Exploring, visual inspection, one-off changes | Automation, scripting, many accounts and Regions | Quick CLI work with no setup, on any computer |
Criteria that decide the choice
Ask these questions in order. The first one with a clear answer usually settles it.
- Will you do this more than once? If yes, prefer a command line. A command can be saved, reviewed, and rerun. A sequence of clicks cannot.
- Do you need your local files, editor, or other tools? If yes, use the local CLI. CloudShell has its own file system and cannot see your laptop.
- Are you on a machine where you cannot install software or hold credentials? If yes, use CloudShell. It needs only a browser and a console sign-in.
- Are you exploring something unfamiliar? Use the Console. Forms show every option and its default, and charts show state at a glance.
- Does the task need long-running work or a persistent environment? Use the local CLI or a managed service. CloudShell sessions end after a period of inactivity.
Where each tool is strongest
Console
The Console is the best place to learn a service. Wizards expose every option with explanations, and dashboards show metrics and relationships that raw JSON hides. It also suits one-off changes where the cost of writing a command exceeds the cost of clicking.
Its weaknesses are that clicks leave no record you can replay and that it is slow across many Regions or accounts. It also depends on the Region selector. Creating resources in the wrong Region is a common mistake, because the Region is easy to overlook in the page header.
Some tasks are Console-oriented by nature, such as account-level settings and reviewing billing pages. Which tasks need the root user is covered under security later in the series.
Local AWS CLI
The local CLI is the right choice for anything repeatable. Named profiles let you switch accounts and roles per command with --profile, and --region overrides the Region per call. Output can be filtered with --query and fed into other tools.
Costs include installation, keeping the CLI updated, and managing credentials on your machine. With IAM Identity Center, your credentials are short-lived. Long-lived access keys on disk are the riskiest option, so avoid them when you can.
CloudShell
CloudShell sits between the other two. You launch it from the Console, and it authenticates as the identity you are signed in with, so there are no keys to configure. The AWS CLI and common tools come preinstalled.
Its limits matter in practice:
- Only the home directory persists between sessions, and that storage is 1 GB per Region. Anything you install outside it is lost when the environment is recycled.
- Sessions end after a period of inactivity, so it is poor for long jobs.
- It does not see your local file system. You move files with the upload and download actions.
- It is not available in every Region. Check the Region you are working in before you plan around it.
- It runs with your console identity's permissions, so it cannot do more than you can do in the Console.
Same task, three approaches
Suppose you need to confirm which identity you are using before changing anything. In the Console, you open the account menu and read the account ID and role name. In either shell, you run one command:
aws sts get-caller-identity --profile devIn CloudShell you omit --profile, because the environment already holds your console identity.
Now suppose you need a count of VPCs in every enabled Region. In the Console you would switch Regions one at a time, which is tedious and easy to get wrong. A loop does it in seconds, from a terminal or from CloudShell:
for r in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
echo "$r: $(aws ec2 describe-vpcs --region "$r" --query 'length(Vpcs)' --output text)"
doneHere the choice between local CLI and CloudShell comes down to convenience. If you already have a configured profile, use the local CLI. If you are on a borrowed laptop, use CloudShell.
Finally, suppose you must upload a website folder from your laptop to S3. The files live on your laptop, so the local CLI is the natural fit. Preview first, because bulk commands are hard to undo:
aws s3 sync ./site s3://amzn-s3-demo-bucket --dryrunFrom CloudShell you would first have to upload the folder to the environment. That extra step usually means the local CLI is the better choice here.
Combining the tools
Experienced users rarely pick one tool for everything. A typical workflow looks like this:
- Explore a new service in the Console to learn its options and vocabulary.
- Note the Region and resource names you see.
- Reproduce the operation with the CLI, using
aws <service> helpto find the matching command. - Save the working commands in a script so the next run is repeatable.
Use CloudShell when you want step 3 without installing anything. It is also handy for testing a command quickly on a machine where your profile is not set up.
Trade-offs and failure modes
- Console drift. Resources changed by hand differ from what your scripts or templates describe. If a team uses scripts or infrastructure as code, make changes through them, and use the Console for reading.
- Wrong profile in a local shell. The CLI uses the default profile when you do not pass
--profile. Running a destructive command against the wrong account is the classic failure. SetAWS_PROFILEdeliberately, or pass--profileexplicitly in scripts. - Wrong Region everywhere. Each tool has its own Region setting. The Console uses the selector, the CLI uses the profile's
regionor--region, and CloudShell starts in the Region you launched it from. A resource that seems to be missing is often in another Region. - Assuming CloudShell is a server. It is a personal, short-lived environment. Do not host jobs or keep important data outside the home directory.
- Pasting long-lived keys into CloudShell. CloudShell already authenticates you, so storing access keys there is unnecessary and adds risk.
A short selection guide
| Situation | Suggested tool |
|---|---|
| Learning a new service | Console |
| Checking a dashboard or a chart | Console |
| Daily or weekly task | Local CLI with a script |
| Task across many Regions or accounts | Local CLI with profiles |
| Quick command on a shared or borrowed computer | CloudShell |
| Need your local files | Local CLI |
| Need no installation and no key management | CloudShell |
Exercise
A teammate must list the S3 buckets in your account once, from a hotel business-center computer where they cannot install software. They can sign in to the Console. Which tool fits best, and why?
Show answer
CloudShell. They can launch it from the Console, it authenticates with their console identity, and the AWS CLI is preinstalled. This avoids installing software or storing credentials on a shared machine. A command such as aws s3api list-buckets --query 'Buckets[].Name' --output text does the job.
Exercise
You run aws ec2 describe-instances from your local terminal and see no instances, but the Console shows several. Name two likely causes that relate to choosing and using the tools.
Show answer
The CLI may be using a different Region than the Console selector, since the profile's region or --region can differ from the Console's Region. The CLI may also be using a different profile or account than your console sign-in. Check with aws sts get-caller-identity and compare the account ID and Region with the Console's account menu and Region selector.
Exercise
You need to apply the same tag change to resources in ten Regions every month. Which tool would you pick, and what safety step would you add?
Show answer
Use the local CLI, or CloudShell if no local setup exists, with a script that loops over Regions using --region. Save the script so the monthly run is repeatable. Before running it, verify the identity with aws sts get-caller-identity and, where the command supports it, preview with --dryrun.