Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.05 KB

README.md

File metadata and controls

35 lines (24 loc) · 1.05 KB

Bedrock with API Gateway

This project is an integration between API Gateway and Bedrock. The calls to Bedrock are made by AWS Lambda. The API is secured with Amazon Cognito.

Deploy

To install the project's dependencies and deploy to AWS, run the following:

pnpm install
cd apps/infra
npx cdk deploy 

Please be aware that the CloudFormation stack is deployed in the eu-central-1 region, as Bedrock is currently unavailable in certain regions.

Call API

To call the API, run the following:

curl --header "Content-Type: text/plain" \
     --header 'Authorization: <IdToken>' \
     --request POST \
     --data 'Who is the CEO of AWS?' \
     'https://<ApiEndpoint>.amazonaws.com/prod'

In the curl command <ApiEndpoint> should be the API endpoint output (which is printed in the terminal after deployment) and <IdToken> should be the ID Token from a registered user in Cognito.

Example response:

The CEO of Amazon Web Services (AWS) is Adam Selipsky. He became CEO of AWS in 2021, replacing Andy Jassy who became CEO of Amazon.