AWS Bedrock Example

#1 : Setup your backend workflow

# 2 : Setup your actions

#3 : Search for SHA256, AWS signature plugins (ADD THEM)

pageNo Code Development

#4 : This is going to be a POST call so...

A. YOU WILL NEED TO CAPTURE and HASH (sha256) an input on the client side (bubble page)

B. Make it fit a JSON template dynamically by creating a workflow -> This will make up your JSON BODY in the API connector later -> add other JSON values as needed for your prompts; may require further formatting, ex: \n

#5 : In the backend: Fill in SHA256 fields for Cannonical

The payload (Yellow) is a dynamic value that you pass from your PROMPT : "(how big are dogs?) in the front end or bubble page value. --> bottom payload left as text to demonstrate Hashing.

NOTE : There are two newlines (enter) after "x-date" -> one small error will ruin your day as the signatures will not match!

#6 : Fill in the AWS signature plugin

#7 : Save result on current user until API is initialized

Note : You have limited time to pass this data to the API connector manually for initialization ...

Use the user field you defined, "string to sign" in this case (result of step 2) as part of the signature in the API connector under AUTHORIZATION (header)

#8 : Bubble API Connector Setup

Full URI

 https://bedrock-runtime.us-east-1.amazonaws.com/model/ai21.j2-mid-v1/invoke

Authorization Header Details ***with exact spacing

AWS4-HMAC-SHA256 Credential=AKSSJSMEXAMPLE/20231003/us-east-1/bedrock/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=939c89dda1eb55b8e4e9aca6c607d2c51c850b2ddc06b661cb8e358f80ffa45

Copy and paste the authorization header (exact spacing) and replace with your own credentials.


Breakdown of Authorization Header

1. AWS4-HMAC-SHA256
2. Credential=AKSSJSMEXAMPLE/20231003/us-east-1/bedrock/aws4_request,
3. SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date,
4. Signature=cef4094a781626a728a46c708235396bae9b4beb6654927132884baac02fd7

# 9 : Initialize the bubble API connector

# 10 : Pass data/values through the backend workflow to the API connector directly AFTER initialization.

Last updated