Skip to content

Latest commit

 

History

History
72 lines (46 loc) · 2.03 KB

File metadata and controls

72 lines (46 loc) · 2.03 KB

Node.js & S3

1-click-deploy

A simple Node.js and AWS S3 app deployed using Defang.

Prerequisites

  1. Download Defang CLI
  2. (Optional) If you are using Defang BYOC authenticate with your cloud provider account
  3. (Optional for local development) Docker CLI

Development

To run the application locally, you can use the following command:

docker compose up --build

Configuration

For this sample, you will need to provide the following configuration:

Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.

AWS_ACCESS_KEY

An API key to access AWS services.

defang config set AWS_ACCESS_KEY

AWS_SECRET_KEY

An API key to access AWS services.

defang config set AWS_SECRET_KEY

Testing

Below is a useful command for testing.

curl -X POST -H 'Content-Type: application/json' -d '{ "first_name" : "jane", "last_name" : "doe" }' https://xxxxxx/upload
curl https://xxxxxx/download

Deployment

Note

Download Defang CLI

Defang Playground

Deploy your application to the Defang Playground by opening up your terminal and typing:

defang compose up

BYOC (AWS)

If you want to deploy to your own cloud account, you can use Defang BYOC:


Title: Node.js & S3

Short Description: A simple Node.js application that uploads and downloads files from AWS S3.

Tags: Node.js, S3, AWS, JavaScript

Languages: nodejs