1472 words
7 minutes

Configure Amazon S3 for Rocket.Chat File Sharing

Cover image for Configure Amazon S3 for Rocket.Chat File Sharing

This article is for those looking for a detailed and clear guide on how to configure Amazon S3 for Rocket.Chat file sharing.

Rocket.Chat is an open-source fully customizable communications platform developed in JavaScript for organizations with high standards of data protection.

NOTE

For details on installing Rocket.Chat on Ubuntu Server, read my guide: Install Rocket.Chat on Ubuntu Server.

IMPORTANT

You must have an account with administrator rights to Amazon Web Services.

IMPORTANT

To set up file sharing, you need to have administrator rights in Rocket.Chat.

First, let’s create a bucket using Amazon S3. It will allow you to store files that Rocket.Chat users will exchange.

Go to the Amazon S3 Console, sign in with an account that has administrator rights (if necessary), and click the “Create bucket” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 1

In the “Bucket name” field, specify a unique DNS-compatible name for the bucket.

Note a few important things when creating a new bucket name:

  • The bucket name must be unique across all existing buckets in Amazon S3.
  • Once the basket is created, you cannot change its name.
  • Choose a bucket name that reflects the purpose of the items you plan to store in it. This is important because the bucket name appears in the URL that points to the items in it.
NOTE

This tutorial will use “rocketchat-heyvaldemar” as the bucket name.

In the “Region” field, indicate the desired region in which the basket will be created.

Click on the “Create” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 2

The cart has been successfully created.

Now you need to configure the access rights to the basket so that Rocket.Chat users can share files using this basket.

We select the previously created basket.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 3

Go to the “Permissions” tab, then select “CORS configuration”.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 4

Next, we insert the following configuration for the basket to work.

NOTE

In this guide, you will use the rocketchat.heyvaldemar.net subdomain to access Rocket.Chat from the Internet. You will need to specify your domain or subdomain by which Rocket.Chat will be accessible from the Internet.

Click on the “Save” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 5

The changes were saved successfully.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 6

Now you need to create a policy to access the previously created S3 bucket.

Click on the “Services” button and select “IAM” in the “Security, Identity & Compliance” section.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 7

Next, go to the “Policies” section and click on the “Create policy” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 8

Go to the “JSON” tab.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 9

Insert the following parameters for the policy.

This guide uses “rocketchat-heyvaldemar” as the bucket name. You will need to provide your cart name.

Click on the “Review policy” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 10

In the “Name” field, specify the name for the new policy and click on the “Create Policy” button.

NOTE

In this tutorial, “RocketChatFileUpload” will be used as the policy name to access the previously created bucket.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 11

The policy has been successfully created.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 12

Now you need to create a new user and assign him the previously created basket access policy. This user will be required to connect Rocket.Chat to S3 bucket.

Go to the “Users” section and click on the “Add users” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 13

In the “User name” field, specify the name for the new user and click on the “Next: Permissions” button.

NOTE

In this manual, “rocketchat-upload” will be used as the username.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 14

Next, select “Attach existing policies directly”.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 15

In the search bar, specify the name of the previously created policy and in the search result, select the desired policy.

NOTE

In this tutorial, “RocketChatFileUpload” is used as the name of the policy to access the previously created bucket.

Click on the “Next: Tags” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 16

In the next step, you do not have to make any changes.

Click on the “Next: Review” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 17

Everything is ready to create a new user.

Click on the “Create user” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 18

The user has been successfully created and has the necessary permissions to access the previously created S3 bucket.

Now you need to save the received “Access key ID” and “Secret access key”. This data will be needed to connect Rocket.Chat to a previously created basket.

Click on the “Show” button to display the contents of the “Secret access key” section and save the contents of the section to a safe place.

Click on the “Close” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 19

The new user will appear in the “Users” section.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 20

Now we need to find the code for the region in which the cart was created.

Visit the AWS documentation page and locate the appropriate region code in the “Region” column next to the “Region Name.” Make sure it matches the region where the bucket was created.

NOTE

In this manual, the bucket was created in the “EU (Frankfurt)” region, so the required region code value is “eu-central-1”.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 21

Now you need to specify the parameters for connecting Rocket.Chat to the previously created basket.

Go to Rocket.Chat under an account with administrator rights, click on the icon with three dots in the upper left corner of the screen and select “Administration”.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 22

Next, we find the “File Upload” section.

File Uploads Enabled must be set to True.

Protect Uploaded Files must be set to True.

File Uploads Enabled must be set to True.

The “Enable Json Web Tokens protection to file uploads” parameter must be set to “True”.

In the “Storage Type” field, select “AmazonS3”.

File Uploads Enabled in Direct Messages must be set to True.

Click on the “Save Changes” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 23

Next, you need to specify the parameters in the “Amazon S3” subsection.

In the “Bucket name” field, specify the name of the previously created bucket.

In the “Access Key” field, specify the “Access key ID” obtained earlier after creating a user.

In the “Secret Key” field, enter the “Secret access key” obtained earlier after creating the user.

Enter the bucket region code—retrieved earlier from the AWS region list—into the “Region” field.

The “Proxy Avatars” parameter must be set to “True”.

Proxy Uploads must be True.

Click on the “Save Changes” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 24

Now let’s upload a file from a computer to a common channel called IT in order to check the correctness of uploading files to Rocket.Chat using the Amazon S3 service.

Open a channel in Rocket.Chat, then in the lower right corner of the screen, click on the plus icon and select “Computer”.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 25

Select the file you want to upload.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 26

The file is ready to upload.

Click on the “Send” button.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 27

The file has been uploaded successfully and is available to all members of the IT channel in Rocket.Chat.

Rocket.Chat users can now share files using the Amazon S3 service.

Configure Amazon S3 for Rocket.Chat File Sharing - Step 28


Social Channels#


Community of IT Experts#


Is this content AI-generated?

No. Every article on this blog is written by me personally, drawing on decades of hands-on IT experience and a genuine passion for technology.

I use AI tools exclusively to help polish grammar and ensure my technical guidance is as clear as possible. However, the core ideas, strategic insights, and step-by-step solutions are entirely my own, born from real-world work.

Because of this human-and-AI partnership, some detection tools might flag this content. You can be confident, though, that the expertise is authentic. My goal is to share road-tested knowledge you can trust.

Configure Amazon S3 for Rocket.Chat File Sharing
https://www.heyvaldemar.com/configure-amazon-s3-for-rocket-chat-file-sharing/
Author
Vladimir Mikhalev
Published at
2019-11-18
License
CC BY-NC-SA 4.0