AWS::OpenSearchServerless::Collection - AWS CloudFormation

AWS::OpenSearchServerless::Collection

Specifies an OpenSearch Serverless collection. For more information, see Creating and managing Amazon OpenSearch Serverless collections in the Amazon OpenSearch Service Developer Guide.

Important

You must create a matching encryption policy in order for a collection to be created successfully. You can specify the policy resource within the same CloudFormation template as the collection resource if you use the DependsOn attribute. See Examples for a sample template. Otherwise the encryption policy must already exist before you create the collection.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::OpenSearchServerless::Collection", "Properties" : { "Description" : String, "Name" : String, "StandbyReplicas" : String, "Tags" : [ Tag, ... ], "Type" : String } }

YAML

Type: AWS::OpenSearchServerless::Collection Properties: Description: String Name: String StandbyReplicas: String Tags: - Tag Type: String

Properties

Description

A description of the collection.

Required: No

Type: String

Maximum: 1000

Update requires: No interruption

Name

The name of the collection.

Collection names must meet the following criteria:

  • Starts with a lowercase letter

  • Unique to your account and AWS Region

  • Contains between 3 and 28 characters

  • Contains only lowercase letters a-z, the numbers 0-9, and the hyphen (-)

Required: Yes

Type: String

Pattern: ^[a-z][a-z0-9-]{2,31}$

Minimum: 3

Maximum: 32

Update requires: Replacement

StandbyReplicas

Indicates whether to use standby replicas for the collection. You can't update this property after the collection is already created. If you attempt to modify this property, the collection continues to use the original value.

Required: No

Type: String

Allowed values: ENABLED | DISABLED

Update requires: No interruption

Tags

An arbitrary set of tags (key–value pairs) to associate with the collection.

For more information, see Tag.

Required: No

Type: Array of Tag

Minimum: 0

Maximum: 50

Update requires: Replacement

Type

The type of collection. Possible values are SEARCH, TIMESERIES, and VECTORSEARCH. For more information, see Choosing a collection type.

Required: No

Type: String

Allowed values: SEARCH | TIMESERIES | VECTORSEARCH

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the collection ID. For more information about using the Ref function, see Ref.

Fn::GetAtt

GetAtt returns a value for a specified attribute of this type. For more information, see Fn::GetAtt. The following are the available attributes and sample return values.

Arn

The Amazon Resource Name (ARN) of the collection. For example, arn:aws:aoss:us-east-1:123456789012:collection/07tjusf2h91cunochc.

CollectionEndpoint

Collection-specific endpoint used to submit index, search, and data upload requests to an OpenSearch Serverless collection. For example, https://07tjusf2h91cunochc.us-east-1.aoss.amazonaws.com.

DashboardEndpoint

The collection-specific endpoint used to access OpenSearch Dashboards. For example, https://07tjusf2h91cunochc.us-east-1.aoss.amazonaws.com/_dashboards.

Id

A unique identifier for the collection. For example, 07tjusf2h91cunochc.

Examples

Create a collection

The following example specifies an OpenSearch Serverless collection named test-collection. The collection type is SEARCH. The template also creates a matching encryption policy, which is required in order for the collection to be created successfully.

For a complete sample policy that creates network, encryption, and access policies, as well as a matching collection, see Using AWS CloudFormation to create Amazon OpenSearch Serverless collections in the Amazon OpenSearch Service Developer Guide.

Note

This example uses public network access, which isn't recommended for production workloads. We recommend using VPC access to protect your collections. For more information, see AWS::OpenSearchServerless::VpcEndpoint and Access Amazon OpenSearch Serverless using an interface endpoint.

JSON

{ "Description":"OpenSearch Serverless collection template", "Resources":{ "TestCollection":{ "Type":"AWS::OpenSearchServerless::Collection", "Properties":{ "Name":"test-collection", "Type":"SEARCH", "Description":"Search collection" }, "DependsOn":"EncryptionPolicy" }, "EncryptionPolicy":{ "Type":"AWS::OpenSearchServerless::SecurityPolicy", "Properties":{ "Name":"test-encryption-policy", "Type":"encryption", "Description":"Encryption policy for test collection", "Policy":"{\"Rules\":[{\"ResourceType\":\"collection\",\"Resource\":[\"collection/test-collection\"]}],\"AWSOwnedKey\":true}" } } }

YAML

Description: OpenSearch Serverless collection template Resources: TestCollection: Type: 'AWS::OpenSearchServerless::Collection' Properties: Name: test-collection Type: SEARCH Description: Search collection DependsOn: EncryptionPolicy EncryptionPolicy: Type: 'AWS::OpenSearchServerless::SecurityPolicy' Properties: Name: test-encryption-policy Type: encryption Description: Encryption policy for test collection Policy: >- {"Rules":[{"ResourceType":"collection","Resource":["collection/test-collection"]}],"AWSOwnedKey":true}