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.
NOTEFor details on installing Rocket.Chat on Ubuntu Server, read my guide: Install Rocket.Chat on Ubuntu Server.
IMPORTANTYou must have an account with administrator rights to Amazon Web Services.
IMPORTANTTo 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.

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.
NOTEThis 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.

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.

Go to the âPermissionsâ tab, then select âCORS configurationâ.

Next, we insert the following configuration for the basket to work.
NOTEIn this guide, you will use the
rocketchat.heyvaldemar.netsubdomain 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.

The changes were saved successfully.

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.

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

Go to the âJSONâ tab.

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.

In the âNameâ field, specify the name for the new policy and click on the âCreate Policyâ button.
NOTEIn this tutorial, âRocketChatFileUploadâ will be used as the policy name to access the previously created bucket.

The policy has been successfully created.

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.

In the âUser nameâ field, specify the name for the new user and click on the âNext: Permissionsâ button.
NOTEIn this manual, ârocketchat-uploadâ will be used as the username.

Next, select âAttach existing policies directlyâ.

In the search bar, specify the name of the previously created policy and in the search result, select the desired policy.
NOTEIn this tutorial, âRocketChatFileUploadâ is used as the name of the policy to access the previously created bucket.
Click on the âNext: Tagsâ button.

In the next step, you do not have to make any changes.
Click on the âNext: Reviewâ button.

Everything is ready to create a new user.
Click on the âCreate userâ button.

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.

The new user will appear in the âUsersâ section.

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.
NOTEIn this manual, the bucket was created in the âEU (Frankfurt)â region, so the required region code value is âeu-central-1â.

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â.

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.

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.

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â.

Select the file you want to upload.

The file is ready to upload.
Click on the âSendâ button.

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.

SIGNAL & INTEL
- The Private Order: Stop being a grunt. Become an Architect. Join The Private Order.