Skip to content

Commit

Permalink
add backblaze b2 example
Browse files Browse the repository at this point in the history
Signed-off-by: karthik2804 <karthik.ganeshram@fermyon.com>
  • Loading branch information
karthik2804 committed Jun 26, 2024
1 parent b75c9a5 commit fe11981
Show file tree
Hide file tree
Showing 10 changed files with 3,930 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/typescript/aws/s3/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AWS S3 Integration

This example showcases how to connect to and send messages using Amazon SQS with the AWS SDK.
This example showcases how to connect to and send messages using Amazon S3 with the AWS SDK.

## Prerequisites
- `spin >=2.6.0`
Expand All @@ -18,15 +18,15 @@ npm install
1. **Create an AWS Account**
- If you don't have an AWS account, create one at [AWS](https://aws.amazon.com/).

2. **Create an SQS Queue**
- Go to the [Amazon SQS Console](https://console.aws.amazon.com/sqs/).
- Create a new SQS queue and note down the Queue URL.
2. **Create an S3 bucket**
- Go to the [Amazon S3 Console](https://console.aws.amazon.com/s3/).
- Create a new bucket and add files to it. Note down the bucket name.

3. **Get AWS Credentials**
- Create or obtain your AWS credentials (Access Key ID, Secret Access Key, and optionally, a Session Token).
- Create or obtain your AWS credentials (Access Key ID, Secret Access Key, and a Session Token).

4. **Configure the Code**
- Copy the region, access key ID, secret access key, session token, and queue URL into the code at `src/index.ts`.
- Copy the region, access key ID, secret access key, session token, and bucket name into the code at `src/index.ts`.

```typescript
const client = new SQSClient({
Expand Down
5 changes: 5 additions & 0 deletions examples/typescript/blob-storage/backblaze/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
target
.spin/
dist.js
45 changes: 45 additions & 0 deletions examples/typescript/blob-storage/backblaze/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Backblaze B2 Integration

This example showcases how to connect to and send messages using Backblaze B2 with the AWS SDK.

## Prerequisites
- `spin >=2.6.0`
-

## Install Dependencies
Install the necessary npm packages:

```bash
npm install
```

## Setup the Example

1. **Create an AWS Account**
- If you don't have an Backblaze account, create one at [Backblaze](https://www.backblaze.com/).

2. **Get Backblaze Credentials**
- Create or obtain your Backblaze credentials (Access Key ID, Secret Access Key).

3. **Configure the Code**
- Copy the region, access key ID, secret access key, into the code at `src/index.ts`.

```typescript
const client = new SQSClient({
endpoint: "<backblaze b2 endpoint"
region: "<region>",
credentials: {
accessKeyId: "<accessKeyId>",
secretAccessKey: "<secretAccessKey>",
},
});
```

## Building and Running the Example

```bash
spin build
spin up
```

Use e.g. curl -v http://127.0.0.1:3000/ to test the endpoint.
Loading

0 comments on commit fe11981

Please sign in to comment.