Skip to content
GitHubXDiscord

DBShardGroup

The DBShardGroup resource allows you to manage AWS RDS DBShardGroups for scalable database architectures that can distribute workloads across multiple shards.

Create a basic DBShardGroup with required properties and a couple of optional settings.

import AWS from "alchemy/aws/control";
const myDBShardGroup = await AWS.RDS.DBShardGroup("myDBShardGroup", {
DBClusterIdentifier: "myDBCluster",
MaxACU: 16,
PubliclyAccessible: true
});

Configure a DBShardGroup with additional settings such as compute redundancy and minimum ACU.

const advancedDBShardGroup = await AWS.RDS.DBShardGroup("advancedDBShardGroup", {
DBClusterIdentifier: "myAdvancedDBCluster",
MaxACU: 32,
MinACU: 8,
ComputeRedundancy: 2,
DBShardGroupIdentifier: "advanced-shard-group",
Tags: [
{
Key: "Environment",
Value: "Production"
},
{
Key: "Project",
Value: "MyProject"
}
]
});

If you want to adopt an existing DBShardGroup without failing if it already exists, you can set the adopt property to true.

const adoptedDBShardGroup = await AWS.RDS.DBShardGroup("adoptedDBShardGroup", {
DBClusterIdentifier: "existingDBCluster",
MaxACU: 20,
adopt: true
});

Create a DBShardGroup that is publicly accessible for development purposes.

const publicDBShardGroup = await AWS.RDS.DBShardGroup("publicDBShardGroup", {
DBClusterIdentifier: "devDBCluster",
MaxACU: 12,
PubliclyAccessible: true,
Tags: [
{
Key: "Environment",
Value: "Development"
}
]
});

When creating a DBShardGroup, you can specify various properties that define its behavior and configuration.

const resourceProperties = {
DBClusterIdentifier: "resourceDBCluster",
MaxACU: 24,
MinACU: 10,
ComputeRedundancy: 3,
DBShardGroupIdentifier: "resource-shard-group",
PubliclyAccessible: false,
Tags: [
{
Key: "Owner",
Value: "TeamA"
}
]
};
const resourceDBShardGroup = await AWS.RDS.DBShardGroup("resourceDBShardGroup", resourceProperties);