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: docs/guides/state.md
+16-11Lines changed: 16 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
1
<!--
2
2
title: 'Serverless Framework State'
3
-
description: 'Learn how to manage state in Serverless Framework Compose.'
3
+
description: 'Learn how to manage state in Serverless Framework'
4
4
short_title: Serverless Framework State
5
5
keywords:
6
6
[
7
7
'Serverless Framework',
8
-
'serverless-compose',
9
8
'state management',
10
9
'S3 state',
11
10
'service state',
@@ -20,28 +19,33 @@ keywords:
20
19
21
20
# Serverless Framework State
22
21
23
-
Serverless Framework Compose allows for the orchestration and deployment of multiple services.
22
+
Serverless Framework allows for the orchestration and deployment of multiple services.
24
23
A crucial aspect of this is managing the state of each service, which includes storing outputs and other runtime information necessary for the correct operation of services.
25
24
This guide covers how to set up and manage state using AWS S3 and AWS SSM.
26
25
26
+
**Note:** Starting from Serverless Framework v4.4.8, the state is saved for all services, not just when using Compose.
27
+
This ensures seamless transitions between Compose and non-Compose deployments without losing state information.
28
+
27
29
## State Management Overview
28
30
29
-
State management in Serverless Framework Compose is crucial for:
31
+
State management in Serverless Framework is crucial for:
30
32
31
33
-**Storing Service Outputs**: Save outputs from deployments to share them across services.
32
34
-**Ensuring Consistency**: Maintain the state of services across deployments, ensuring that each service can access the necessary data for its operation.
33
35
-**Handling Dependencies**: Automatically resolve dependencies between services by referencing shared state.
34
36
35
-
Serverless Framework Compose uses AWS S3 to store the state of services and AWS SSM (Systems Manager) to track the location of the state storage.
37
+
Serverless Framework uses AWS S3 to store the state of services and AWS SSM (Systems Manager) to track the location of the state storage.
36
38
37
39
## Zero-Configuration Setup
38
40
39
-
The easiest way to manage state in Serverless Framework Compose is through its default, zero-configuration setup. When you don’t specify any state configuration, Serverless Framework Compose automatically handles everything for you.
41
+
The easiest way to manage state in Serverless Framework is through its default, zero-configuration setup.
42
+
When you don’t specify any state configuration, Serverless Framework automatically handles everything for you.
43
+
To specify custom state management settings, for example, if you want to use an existing S3 bucket, see the [Custom State Configuration](#custom-state-configuration) section.
40
44
41
45
### How It Works
42
46
43
-
1.**Automatic S3 Bucket Creation**: If no state configuration is provided in your `serverless-compose.yml`, Serverless Framework Compose automatically creates an S3 bucket to store the state.
44
-
2.**SSM Parameter Store**: The name and region of the automatically created S3 bucket are stored in AWS SSM Parameter Store under the parameter `/serverless-framework/state/s3_bucket`. This parameter contains a JSON object with the following keys:
47
+
1.**Automatic S3 Bucket Creation**: If no state configuration is provided in your `serverless.yml` or `serverless-compose.yml`, Serverless Framework automatically creates an S3 bucket to store the state.
48
+
2.**SSM Parameter Store**: The name and region of the automatically created S3 bucket are stored in AWS SSM Parameter Store in `us-east-1` AWS region, under the parameter `/serverless-framework/state/s3-bucket`. This parameter contains a JSON object with the following keys:
45
49
46
50
-`bucketName`: The name of the S3 bucket.
47
51
-`bucketRegion`: The AWS region where the bucket is located.
@@ -51,9 +55,9 @@ The easiest way to manage state in Serverless Framework Compose is through its d
51
55
**Note**: To create the default state bucket, you must have the necessary permissions to put SSM parameters and create versioned S3 buckets.
52
56
If you don’t have these permissions, you can set up a [custom state configuration](#custom-state-configuration) to use an existing S3 bucket.
53
57
54
-
### Example
58
+
### Using State with Serverless Framework Compose
55
59
56
-
Assume you have the following serverless-compose.yml with two services:
60
+
Assume you have the following configuration with two services:
57
61
58
62
```yaml
59
63
services:
@@ -98,7 +102,8 @@ making it easy to manage and deploy services with complex interdependencies.
98
102
## Custom State Configuration
99
103
100
104
While the zero-configuration setup is convenient, there may be situations where you want to customize how and where the state is stored.
101
-
If you require this level of customization, you can specify custom state management settings in your `serverless-compose.yml`.
105
+
If you require this level of customization,
106
+
you can specify custom state management settings in your `serverless.yml` or `serverless-compose.yml`.
0 commit comments