Transforming images in an Object Storage bucket using Serverless Functions and Triggers - Set up
Serverless Functions are an asynchronous microservices architecture where event sources are separated from event consumers.
They work best when they are triggered by specific events, such as cron schedules, which means they can be edited without having to modify every microservice in the process.
In this tutorial, you will create the following resources to use your functions:
- A project dedicated to this tutorial
- Two buckets to store media
- A queue to manage events
- IAM credentials to secure your environment
Before you start
To complete the actions presented below, you must have:
Creating a Project
- Click the Projects tab from the Organization Dashboard. A list of your Projects displays.
- Click + Create Project on the right-hand side. A pop-up displays.
- Name the project
Functions Tutorial
. - Click Create Project. The new Project is added to the list.
Creating the source bucket
- Click Object Storage under Storage on the left side menu of the console. The Object Storage dashboard displays.
- Click + Create a bucket.
- Name it
source-images-<YOUR_NAME>
. - Choose the Amsterdam region.
- Set the bucket visibility to Private.
- Click Create bucket. The bucket's Files tab displays.
- Upload your images to the bucket and select the Standard storage class.
Creating the destination bucket
- Click Storage, then Object Storage on the left side menu of the console. The Object Storage dashboard displays.
- Click + Create a bucket.
- Name it
dest-images-<YOUR_NAME>
. - Choose the Amsterdam region.
- Set the bucket visibility to Private.
- Click Create Bucket.
Generating credentials for Scaleway Queues
- Click Queues under Integration Services on the left side menu of the console.
- Click + Generate credentials.
- Name your credentials
Function Push
. - Enable the Write, Read and Manage permissions.
- Click Generate credentials.
- Store the access key ID and the secret key securely, as you will not be able to access them later.
Creating a queue
- Click Queues under Integration Services on the left side menu of the console.
- Click Create queue.
- Select Standard as a queue type.
- Name it
image-queue
. - Keep the default parameters.
- Click Create queue.
Creating IAM credentials
Identity and Access Management (IAM) credentials allow you to secure access to your buckets, functions, etc.
- Click the Organization in the top right corner and Select API keys. The IAM API keys tab displays.
- Click + Generate an API key or the plus icon button.
- Select Myself (IAM) as the API key Bearer.
- Enter
API key for the Function Tutorial
as a description. - Set Expiration to One Week.
- Select Yes, set up preferred Project.
- Choose the Functions Tutorial project (or the name you gave to this project).
- Click Generate API key.
- Store the Access key ID and the Secret key securely, as you will not be able to access them later.
Enabling monitoring with Cockpit
- Click Cockpit under Monitoring.
- Click the Grafana users tab.
- Click + Add user.
- Enter a username.
- Select the Editor role.
- Click Add user.
- Store the password securely, as you will not be able to access it later.
Creating and deploying functions
You have created all the necessary resources, it is now time to create functions.
Questions?
Visit our Help Center and find the answers to your most frequent questions.
Visit Help Center