Container used to upload files to S3
February 1, 2024 ยท View on GitHub
This container does the following:
- Read a file from an HTTP request form
- Store the file in S3
Requirements
- You have an account and are logged into the Scaleway console
- You have created an API key in the console, with at least the
ObjectStorageFullAccess,ContainerRegistryFullAccess, andFunctionsFullAccesspermissions, plus access to the relevant project for Object Storage - You have Terraform installed on your machine
- You have logged in to the Scaleway Container Registry (
scw registry login)
Deploy on Scaleway
First you need to set the following environment variables:
export TF_VAR_access_key=<your API access key>
export TF_VAR_secret_key=<your API secret key>
export TF_VAR_project_id=<your project id>
Deployment can be done by running:
terraform init
terraform plan
terraform apply
You can then query your function by running:
# Upload a random Terraform file to the bucket
curl -F file=@container.tf $(terraform output -raw endpoint)
You can get the bucket name with:
terraform output -raw bucket_name
You should then see the requirements.txt file uploaded to your bucket.