The AWS Bedrock Tutorial I Wish I Had: Everything You Need to Know to Prepare Your Machine for AWS Infrastructure | by Minda Myers | Oct, 2024

Editor
8 Min Read


The remainder of this article will focus on setting up the sample AWS Bedrock app properly and getting it to run locally on your development machine. This part can be particularly tricky due to the fragmentation of documentation on Amazon’s website. We will expand upon the instructions from the Prerequisites section of the original tutorial and flesh out the steps to get all the requirements installed correctly.

Prerequisites

📌 Note: sudo and Command Line Usage

Many of the upcoming sections require extensive use of your command line / terminal. If you happen to encounter permission errors, try prefixing your command with sudo.

For example, instead of usingnpm install -g aws-cdk, give sudo npm install -g aws-cdk a try.

One of the first (and honestly most frustrating) parts for a beginner can be getting your AWS account set up with the right credentials. Below is a step-by-step process so you don’t have to spend hours bouncing around AWS’s website and documentation in an effort to piece together the correct sequence of actions.

Sign up for an AWS account.

Then log in and navigate to IAM in your console. Click on Users -> Create User

Now, you’ll need to customize the following details as you step through the Create User flow.

Step 1: Specify User Details

  • Check the box for Provide user access to the AWS Management Console
  • Select I want to create an IAM user
  • In the Console password section, select Custom password. Enter a secure and memorable password.
  • Uncheck Users must require a new password at next login so the user doesn’t have to reset the password upon first login.

Step 2: Set Permissions

  • Select Attach policies directly.
  • In the search bar, type AdministratorAccess
  • Check the box next to the AdministratorAccess policy in the search results.

Next, click Create user in Step 3 and click Return to users list in Step 4. Remember to save your password in a secure location.

After setting up your IAM user, you’ll need to install the required software tools, starting with Node.js.

You must already have NPM (Node Package Manager) installed to set up any of Amazon’s developer tools on your local machine. Our next step will be to install Node.js, which includes NPM. The sample project requires Node.js v18 or higher, so we will install the latest version to cover this dependency.

For Mac:

  • Visit the official Node.js website. You can either copy and paste commands into your terminal to download and install via the command line, or simply download the installer for Mac.

For Linux (Ubuntu):

sudo apt install nodejs npm

Verify the installation:

node --version 
npm --version

With Node.js installed, the next step is setting up the AWS Cloud Development Kit (CDK) with NPM.

Now, we will show you how to use NPM to install AWS CDK. The sample app requires AWS CDK 2.103 or later so we will download the most recent version (which ensures this requirement is met).

Enter the following command to install AWS CDK globally:

sudo npm install -g aws-cdk

Let’s verify the installation:

cdk --version

With CDK installed, we can install AWS CLI (Command Line Interface), which will allow you to configure your AWS account credentials.

Installing and Configuring AWS CLI

Setting up your account credentials is essential to correctly setting up the sample app, so let’s cover how to install AWS CLI and set up your account correctly.

Installing AWS CLI

The method to install AWS CLI differs slightly depending on your operating system.

For Linux, download and run an installer:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

For Mac, download the *.pkg file from the AWS CLI website and follow the instructions in the installation wizard.

Let’s wrap up this step by verifying that the installation worked:

aws --version

Creating Access Keys

Now that we have AWS CLI installed, we can move on to creating access keys. If you followed the instructions in the video from Step 1, you already have your access keys created. If not, go ahead and review the end of the video again or follow these directions:

  • In the IAM dashboard, look for the user you want to create access keys for.
  • In the user Summary section, click on “Create access key”
  • Check “I understand the above recommendation and want to proceed to create an access key”
  • Copy and paste your access key and secret access key in a safe location.

Configuring AWS CLI

We are almost there! With one last step, your account will be configured correctly on your development machine.

Run this command to launch the configuration process:

aws configure

You’ll be asked to enter the following:

  • AWS Access Key ID (copy / paste from your secure location)
  • AWS Secret Access Key (copy / paste from your secure location)
  • Default region name (we used us-east-1)
  • Default output format (use json)

Once this step is complete, your account details will be configured, and you can move on to getting ready to deploy AWS CDK infrastructure.

Next, we will show you how to bootstrap your CDK in the region you wish to deploy.

cdk bootstrap aws://ACCOUNT-NUMBER/REGION

Here, you will need to use your 12 digit account number (you can find this at the top right of your screen on the AWS console) for ACCOUNT-NUMBER and your region (we use us-east-1) for REGION.

You’re almost there! Now you just need to install the additional tools for the project and you will have the sample app setup.

This project uses yarn to manage dependencies. You can install it with NPM:

sudo npm install -g yarn

You can verify that yarn installed correctly:

yarn --version

Git:

Git comes pre-installed on Mac and most Linux distributions. You can verify that it’s installed.

git --version

If it’s not already installed, on Ubuntu you can use apt-get sudo apt-get install git and on Mac it can be downloaded from the official Git website.

Docker:

On Mac, you can download Docker Desktop for Mac from the official Docker website and then just follow the installation wizard.

For Linux (Ubuntu), you can follow the official Docker installation guide for Ubuntu.

Congratulations! You’ve completed Part 1 of this series and should now have your development environment with all the dependencies set up so that you can deploy this AWS sample app. You can now pick up from the original tutorial’s Setup section and download the project code using Git.

Share this Article
Please enter CoinGecko Free Api Key to get this plugin works.