Getting Started with AWS Cloud Shell

· 4min · Pragmatic AI Labs

This comprehensive guide will equip you with the skills to effectively utilize the AWS Command Line Interface (CLI) and Cloud Shell for interacting with Amazon Bedrock. We'll cover foundational CLI commands, JSON processing, and essential Bedrock interactions, all within the convenient environment of Cloud Shell.

Why Cloud Shell?

AWS Cloud Shell is a browser-based shell that provides a pre-configured environment for managing AWS resources. Here's why it's ideal for working with the AWS CLI:

  • Pre-authenticated: No need to configure AWS credentials or API keys.
  • Accessible: Use it from any device with a web browser.
  • Pre-configured: The AWS CLI is already installed and ready to use.
  • Persistent storage: Your files and scripts are saved for future sessions.

Launching Cloud Shell

  1. Navigate to the AWS Management Console.
  2. Click the Cloud Shell icon in the top navigation bar.

Verifying Your Environment

Before we dive into CLI commands, let's ensure we're in the correct region:

echo $AWS_REGION

Bedrock is currently available in us-east-1. If your region is different, use the region selector in the Cloud Shell top bar to switch.

Next, verify your AWS identity:

aws sts get-caller-identity

This confirms you're authenticated and ready to interact with AWS services.

Essential CLI Commands

Let's explore some fundamental CLI commands:

  • ls -l: List files in your home directory.
  • pwd: Print the current working directory.
  • date: Display the current date and time.

These commands are standard Linux commands that you can use within Cloud Shell.

Getting Help with the CLI

The AWS CLI provides extensive help documentation:

  • aws help: Display general help information for the AWS CLI.
  • aws s3 help: Get help for the S3 service.
  • aws s3 ls --help: Get help for the ls command within the S3 service.

Working with JSON Output

Many AWS CLI commands return output in JSON format. To make this output more readable, we can use the jq command:

  • aws ec2 describe-regions: List available AWS regions (raw JSON output).
  • aws ec2 describe-regions | jq '.Regions[].RegionName': List available AWS regions (formatted with jq).

Interacting with Amazon Bedrock

Now, let's use the CLI to interact with Amazon Bedrock:

  • aws bedrock list-foundation-models --region us-east-1: List available foundation models in Bedrock.
aws bedrock list-foundation-models --region us-east-1 | jq -r '.modelSummaries[] | select(.modelId | startswith("anthropic.claude-3")) | .modelId'

List available Claude models in Bedrock (filtered with jq).

Conclusion

By mastering the AWS CLI and Cloud Shell, you gain a powerful and efficient way to manage AWS services, including Amazon Bedrock. This foundation will enable you to explore the Bedrock API and build innovative AI/ML applications.


Want expert ML/AI training? Visit paiml.com

For hands-on courses: DS500 Platform

Based on this article's content, here are some courses that might interest you:

  1. AWS Advanced AI Engineering (1 week) Production LLM architecture patterns using Rust, AWS, and Bedrock.
  2. Natural Language AI with Bedrock (1 week) Get started with Natural Language Processing using Amazon Bedrock in this introductory course focused on building basic NLP applications. Learn the fundamentals of text processing pipelines and how to leverage Bedrock's core features while following AWS best practices.
  3. AWS AI Analytics: Enhancing Analytics Pipelines with AI (3 weeks) Transform analytics pipelines with AWS AI services, focusing on performance and cost optimization
  4. Natural Language Processing with Amazon Bedrock (2 weeks) Build production NLP systems with Amazon Bedrock
  5. AWS AI Analytics: Building High-Performance Systems with Rust (3 weeks) Build high-performance AWS AI analytics systems using Rust, focusing on efficiency, telemetry, and production-grade implementations

Learn more at Pragmatic AI Labs