Use AWS Bedrock like a Copilot in VSCode

Daniel Avila
4 min readJan 18, 2024

--

In this tutorial, I will show you how to activate AWS Bedrock and use its Generative AI models within VSCode to assist you in programming

Enable Generative AI models with AWS Bedrock

Access the AWS console and in the search input, type ‘bedrock’

Select Amazon Bedrock, and it will open the following screen:

Go to the Providers tab; in this section, you’ll be able to see all the LLM providers that AWS has available.

To check which models you have access to, go to the ‘Model Access’ section.

Inside, you can see each provider with their respective models, and in the ‘Access Status’ column, you can determine whether you have access to that particular model or not.

In this case, we are going to request access to Meta’s Llama 2 models.

Select ‘Manage Access,’ and then choose all the models for which you are going to request access.

After a couple of minutes, you should have access to these models

Once you have access to the models, you can open VSCode and download the CodeGPT extension.

Connect AWS Bedrock with CodeGPT

After installation, open the chat menu, and in the Providers selector, you can choose the option ‘AWS Bedrock’.

Upon selecting it, the connection window will open, where you need to add the region of your account, followed by the Access Key ID, and finally, the Secret Access Key.

Complete the following details:

Region: You can obtain it from the web console where you have your Bedrock models enabled.

Access Key ID and Secret Access Key: You can obtain them from the IAM section of AWS.

You need to create a user with AmazonBedrockFullAccess permissions

After creating this user, you’ll be able to view the Access Key ID and Secret Access Key for this user.

Select the model and use Bedrock as a Copilot

In the model selector, choose the model you want to use; in this case, let’s select ‘anthropic.claude-v2’

That’s it! Now you have all the models available in AWS Bedrock to use as a ‘Copilot’ within VSCode.

You can select the code and ask CodeGPT with the AWS Bedrock — Anthropic Claude 2 model to make a projection in Python on the code you already have in a Jupyter notebook in VSCode.

links:
Download VSCode:

Download CodeGPT:

Create a Free CodeGPT Account:

--

--