You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/large-messages/index.mdx
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ meta:
4
4
description: Learn how to build a serverless architecture for handling large messages with Scaleway's NATS, Serverless Functions, and Object Storage. Follow our step-by-step Terraform-based tutorial for asynchronous file conversion using messaging, functions, and triggers.
5
5
content:
6
6
h1: Create a serverless architecture for handling large messages using Scaleway's NATS, Serverless Functions, and Object Storage.
7
-
paragraph: Learn how to build a serverless architecture for handling large messages with Scaleway's NATS, Serverless Functions, and Object Storage. Follow our step-by-step Terraform-based tutorial for asynchronous file conversion using messaging, functions, and triggers.
7
+
paragraph: Learn how to build a serverless architecture for handling large messages with Scaleway's NATS, Serverless Functions, and Object Storage. Follow our step-by-step Terraform-based tutorial for asynchronous file conversion using messaging, functions, and triggers.
8
8
categories:
9
9
- messaging
10
10
- functions
@@ -52,7 +52,7 @@ Three essential services are required to ensure everything is working together:
52
52
<Messagetype="tip">
53
53
Remember that you can refer to the [code repository](https://github.com/rouche-q/serverless-examples/tree/main/projects/large-messages/README.md) to check all code files.
54
54
</Message>
55
-
```terraform
55
+
```hcl
56
56
terraform {
57
57
required_providers {
58
58
scaleway = {
@@ -74,7 +74,7 @@ Three essential services are required to ensure everything is working together:
74
74
The Scaleway provider is needed, but also three providers from HashiCorp that we will use later in the tutorial.
75
75
76
76
2. Include two variables to enable the secure passage of your Scaleway credentials. Then initialize the Scaleway provider in the `fr-par-1` region.
77
-
```terraform
77
+
```hcl
78
78
variable "scw_access_key_id" {
79
79
type = string
80
80
sensitive = true
@@ -97,7 +97,7 @@ Three essential services are required to ensure everything is working together:
97
97
```
98
98
99
99
4. Continuing in the `main.tf` file, add the following Terraform code to create an Object Storage bucket that will be used for storing your images.
100
-
```terraform
100
+
```hcl
101
101
resource "random_id" "bucket" {
102
102
byte_length = 8
103
103
}
@@ -119,7 +119,7 @@ Three essential services are required to ensure everything is working together:
119
119
In this code, the resource `random_id.bucket` generates a random ID, which is then passed to the object bucket to ensure its uniqueness. Additionally, a `scaleway_object_bucket_acl` ACL is applied to the bucket, setting it to private and outputting the bucket name for use in your producer.
120
120
121
121
5. Add these resources to create a NATS account and your NATS credentials file:
@@ -162,7 +162,7 @@ As mentioned earlier, the producer will be implemented as a straightforward shel
162
162
Our script takes the file path that we want to upload as the first parameter.
163
163
164
164
To upload the file, we will use the AWS CLI configured with the Scaleway endpoint and credentials because Scaleway Object storage is fully compliant with S3.
165
-
165
+
166
166
3. Pass the path to the AWS CLI command as follows:
167
167
```bash
168
168
aws s3 cp $1 s3://$SCW_BUCKET
@@ -211,7 +211,7 @@ We continue using the Scaleway ecosystem and deploy the consumer using a Serverl
211
211
```
212
212
213
213
5. Before proceeding with the function's logic, improve the Terraform code by adding the following code to your `main.tf` file:
214
-
```terraform
214
+
```hcl
215
215
resource "null_resource" "install_dependencies" {
216
216
provisioner "local-exec" {
217
217
command = <<-EOT
@@ -240,15 +240,15 @@ We continue using the Scaleway ecosystem and deploy the consumer using a Serverl
240
240
The `null_resource` is used to download and package the correct versions of the libraries that we use with the function. Learn more about this in the [Scaleway documentation.](/serverless/functions/how-to/package-function-dependencies-in-zip/#specific-libraries-(with-needs-for-specific-c-compiled-code))
It defines which account ID and subject to observe for getting messages.
289
289
@@ -364,6 +364,6 @@ terraform apply
364
364
## Conclusion, going further
365
365
366
366
In this introductory tutorial, we have demonstrated the usage of the NATS server for Messaging and Queuing, along with other services from the Scaleway ecosystem, to facilitate the transfer of large messages surpassing the typical size constraints. There are possibilities to expand upon this tutorial for various use cases, such as:
367
-
367
+
368
368
- Extending the conversion capabilities to handle different document types like `docx`.
369
369
- Sending URLs directly to NATS and converting HTML content to PDF.
0 commit comments