Skip to content
32 changes: 29 additions & 3 deletions src/l1-resources/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ The official [MongoDB Atlas](https://www.mongodb.com/) AWS CDK resource for Node

## Description

The cluster resource provides access to your cluster configurations. The resource lets you create, edit and delete clusters. The resource requires your Project ID.
The cluster resource provides access to your cluster configurations and enables you to create, edit, and delete clusters. The cluster resource requires your Project ID.

## MongoDB Atlas API Docs

For more information about the API refer to: [API Endpoints](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-clusters)

## Usage

In order to use this library, you will need to activate this AWS CloudFormation Registry type in your account. You can do this via the AWS Management Console or using the [AWS CLI](https://aws.amazon.com/cli/) using the following command:
In order to use this library, you must activate the following AWS CloudFormation Registry type in your account. You can do this via the AWS Management Console or through the [AWS CLI](https://aws.amazon.com/cli/) using the following command:

```sh
aws cloudformation activate-type \
Expand All @@ -37,8 +37,8 @@ aws cloudformation activate-type \

You can find more information about activating this type in the [AWS CloudFormation documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry-public.html).


## Example: [cluster.ts](../../../examples/l1-resources/cluster.ts)

```ts
import { CfnCluster } from 'awscdk-resources-mongodbatlas';

Expand Down Expand Up @@ -90,6 +90,32 @@ const clusterRes = new CfnCluster(this, 'ClusterResource', {

```

## Flex Clusters

You can create a flex cluster using ``CfnCluster``, as the following example shows:

```ts
import { CfnCluster, AdvancedRegionConfigProviderName } from 'awscdk-resources-mongodbatlas';

const flexClusterRes = new CfnCluster(this, 'FlexClusterResource', {
name: atlasProps.clusterName,
projectId: projectRes.attrId,
profile: atlasProps.profile,
replicationSpecs: [{
advancedRegionConfigs: [{
regionName: atlasProps.region,
providerName: AdvancedRegionConfigProviderName.FLEX,
backingProviderName: "AWS",
priority: 7,
}]
}]
});
```

*Note:* Upgrades to or from flex clusters are currently unavailable. We expect to support upgrades to or from flex clusters in the forseeable future.

*Important:* Use the `CfnCluster` resource instead of the [CfnFlexCluster](https://github.com/mongodb/awscdk-resources-mongodbatlas/blob/main/src/l1-resources/flex-cluster/README.md) resource to create and manage flex clusters. `CfnCluster` supports flex clusters and future upgrades will only be available through this resource.

## Feedback

This library is auto-generated and published to all supported programming languages by the [cdklabs/cdk-cloudformation] project based on the API schema published for `MongoDB::Atlas::Cluster`.
Expand Down