# AWS Bedrock Example

## #1 : Setup your backend workflow

<figure><img src="/files/HViwUCt9wI5L9edjqHZN" alt=""><figcaption></figcaption></figure>

## # 2 : Setup your actions

<figure><img src="/files/tBFnySiq0KCPzSQlDSq1" alt=""><figcaption></figcaption></figure>

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

{% content-ref url="/pages/-M\_LZES6FJVCxflK6j9l" %}
[No Code Development](/no-code.md)
{% endcontent-ref %}

## #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)

<figure><img src="/files/gZCvn6fQk08uKu3OQmCr" alt="" width="375"><figcaption></figcaption></figure>

## 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

<figure><img src="/files/ki8hx5jcoF4VnfYSyHdj" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/hLkpbfxH0xdPRgyX6shL" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/jROzeiwlkWgPEMusBflL" alt=""><figcaption><p>One newline(press enter) after each entry , NONE for the last entry</p></figcaption></figure>

## #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 ...

<figure><img src="/files/LK6MXfHxFBH6eazWIZCw" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
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)
{% endhint %}

## #8 : Bubble API Connector Setup

<figure><img src="/files/liOxElGtvTblCmp88rhV" alt=""><figcaption></figcaption></figure>

### 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
```

{% hint style="info" %}
Copy and paste the authorization header (exact spacing) and replace with your own credentials.
{% endhint %}

***

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://products.fliplist.co/free/aws4/aws-bedrock-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
