---
title: Transforming images in an Object Storage bucket using Serverless Functions and Triggers - Set up
description: This page shows you how to set up your environment to transform images in an Object Storage bucket using Serverless Functions and Triggers
products:
  - queues
  - functions
  - object-storage
tags: serverless functions triggers sqs
dates:
  validation: 2024-10-21
  posted: 2023-07-07
  validation_frequency: 24
---
import Requirements from '@macros/iam/requirements.mdx'
import CockpitIamPermissions from '@macros/cockpit/iam-permissions-cockpit.mdx'


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

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- Installed [Node.js](https://nodejs.org/en/download) and [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- At least 10 JPG or PNG images

<CockpitIamPermissions />

## Creating a Project

1. Click the **Projects** tab from the [Organization Dashboard](https://console.scaleway.com/organization). A list of your Projects displays.
2. Click **+ Create Project** on the right-hand side. A pop-up displays.
3. Name the project `Functions Tutorial`.
4. Click **Create Project**. The new Project is added to the list.

## Creating the source bucket

1. Click **Object Storage** under **Storage** on the left side menu of the console. The Object Storage dashboard displays.
2. Click **+ Create a bucket**.
3. Name it `source-images-<YOUR_NAME>`.
4. Choose the **Amsterdam** region.
5. Set the bucket visibility to **Private**.
6. Click **Create bucket**. The bucket's **Files** tab displays.
7. Upload your images to the bucket and select the **Standard** storage class.

## Creating the destination bucket

1. Click **Storage**, then **Object Storage** on the left side menu of the console. The Object Storage dashboard displays.
2. Click **+ Create a bucket**.
3. Name it `dest-images-<YOUR_NAME>`.
4. Choose the **Amsterdam** region.
5. Set the bucket visibility to **Private**.
6. Click **Create Bucket**.

## Generating credentials for Scaleway Queues

1. Click **Queues** under **Integration Services** on the left side menu of the console.
2. Click **+ Generate credentials**.
3. Name your credentials `Function Push`.
4. Enable the **Write**, **Read** and **Manage** permissions.
5. Click **Generate credentials**.
6. Store the access key ID and the secret key securely, as you will not be able to access them later.

## Creating a queue

1. Click **Queues** under **Integration Services** on the left side menu of the console.
2. Click **Create queue**.
3. Select **Standard** as a queue type.
4. Name it `image-queue`.
5. Keep the default parameters.
6. Click **Create queue**.

## Creating IAM credentials

Identity and Access Management (IAM) credentials allow you to secure access to your buckets, functions, etc.

<Message type="note">
    For this tutorial, we will use *User* credentials which are simpler to use. However, for production-grade Serverless applications, we recommend using *Application* credentials with the minimum possible rights.
</Message>

1. Click the Organization in the top right corner and Select **API keys**. The IAM **API keys** tab displays.
2. Click **+ Generate an API key** or the <Icon name="plus" /> button.
3. Select **Myself (IAM)** as the API key Bearer.
4. Enter `API key for the Function Tutorial` as a description.
5. Set **Expiration** to **One Week**.
6. Select **Yes, set up preferred Project**.
7. Choose the **Functions Tutorial** project (or the name you gave to this project).
8. Click **Generate API key**.
9. Store the Access key ID and the Secret key securely, as you will not be able to access them later.

## Creating and deploying functions

You have created all the necessary resources, it is now time to [create functions](/tutorials/transform-bucket-images-triggers-functions-deploy/).

<Message type="tip">
Setting up an environment with all the necessary resources can be time-consuming. You can use IaC (Infrastructure as Code) tools such as [Terraform/OpenTofu](/tutorials/manage-instances-with-terraform-and-functions/) to automate a project's configuration.
</Message>