|
| 1 | +# S3 Request Signing Example |
| 2 | + |
| 3 | +https://edgio-community-examples-v7-aws-s3-request-signing-live.glb.edgio.link/ |
| 4 | + |
| 5 | +## Description |
| 6 | + |
| 7 | +This repository provides example code for signing requests to an S3 origin using AWS v4 signature algorithm with Edge Functions. It demonstrates how to handle requests using a router and forward them to an S3 bucket with proper authentication. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +**NOTE**: To use this project, you must be an Edgio customer and signed up for the Edge Functions. See our [Edge Functions documentation](https://docs.edg.io/guides/v7/edge-functions) for information on activating this feature. |
| 12 | + |
| 13 | +The system requirements include Node.js v18 or higher, and a UNIX-like system (Linux or macOS). The project code is written in JavaScript. |
| 14 | + |
| 15 | +## Setup and Installation |
| 16 | + |
| 17 | +1. Ensure you meet the prerequisites. |
| 18 | +2. Clone the repository to your local machine. |
| 19 | +3. Run `npm install` in the repository directory. |
| 20 | + |
| 21 | +## Environment Variables |
| 22 | + |
| 23 | +The following environment variables need to be set for the edge function to authenticate and sign requests correctly: |
| 24 | + |
| 25 | +- `S3_HOSTNAME`: The S3 bucket hostname. |
| 26 | +- `S3_REGION`: The AWS region where the S3 bucket is located. |
| 27 | +- `S3_ACCESS_KEY_ID`: Your AWS access key ID. |
| 28 | +- `S3_SECRET_ACCESS_KEY`: Your AWS secret access key. |
| 29 | + |
| 30 | +When running the project locally, these variables can be defined in a `.env` file or directly in the environment. For deployment on Edgio, these should be set in the Edgio Developer Console. |
| 31 | + |
| 32 | +## Getting Started |
| 33 | + |
| 34 | +After setting up the project, run `npm run edgio:dev` to start a local development server to test the example functions. |
| 35 | + |
| 36 | +To deploy the project to Edgio, use the command `npm run edgio:deploy`. Note that deployment to Edgio requires you to be logged into Edgio CLI which can be done via `npm run edgio login` and following the instructions. |
| 37 | + |
| 38 | +## Support |
| 39 | + |
| 40 | +If you have any queries or face issues with this project, please don't hesitate to contact the [Edgio team](https://edg.io/contact-support/). |
| 41 | + |
| 42 | +## License |
| 43 | + |
| 44 | +[Creative Commons Attribution 4.0 International Public License](LICENSE-CONTENT) for the documentation. |
| 45 | + |
| 46 | +[MIT License](LICENSE-CODE) for the code. |
0 commit comments