You can upload and download from AWS S3 inside val functions.
In this guide, you’ll create an AWS bucket, an IAM user, and then test your set up is correct by uploading and downloading a small text file.
Log in to the AWS Console and go to https://s3.console.aws.amazon.com/s3/bucket/create
Create a new bucket by choosing a Bucket name (leave the defaults for everything else).
Save the Bucket name and your AWS region as Val Town secrets as awsS3Bucket
and awsS3Region
respectively. Although these values aren’t secrets, doing this means you can copy and paste the val examples in this guide without making any code changes.
Continue to use this AWS region for the rest of this guide.
Go to https://console.aws.amazon.com/iamv2/home#/users and click Add users.
Choose a User name.
Select Attach policies directly.
Give this user AmazonS3FullAccess
by searching and selecting the checkbox under Permissions policies.
(This allows this user the highest level of S3 permissions across all of the buckets for the AWS account you’re logged into. Consider setting up granular permissions with AWS’s Bucket owner granting its users bucket permissions guide.)
On the final page, click Create user.