DEV Community

hvmathan
hvmathan

Posted on

Troubleshooting and Fixing AWS DMS Instance Creation Error

Are you encountering an error while attempting to create an instance in AWS Database Migration Service (DMS)? Don't fret; you're not alone. Recently, I stumbled upon an issue during DMS instance creation and delved into the solution to share my insights with you.

The Error:
You might come across an error message similar to this:

**Error**: creating DMS Replication Instance (my-replication-instance1): InvalidSubnet: No default subnet detected in VPC. Please contact AWS Support to recreate default Subnets
Enter fullscreen mode Exit fullscreen mode

Understanding the Error:
This error crops up when DMS fails to identify a default subnet in the Virtual Private Cloud (VPC). By default, DMS attempts to utilize the default VPC subnet group. However, if the default VPC or its associated subnet group isn't available, the creation process hits a snag.

Root Cause:
The crux of the issue lies in the absence of a specified subnet group. Without explicit instructions, DMS defaults to the non-existent default VPC subnet group, resulting in the error.

Resolution:
The fix is straightforward. Create a DMS subnet group aligned with the custom subnets provisioned in your VPC. Then, when initiating the replication instance creation, ensure to specify this subnet group explicitly.

Implementation via AWS CDK:
Here's a step-by-step guide to achieving the resolution using AWS CDK:

Import Necessary Libraries:

import { DmsReplicationInstance } from "@cdktf/provider-aws/lib/dms-replication-instance";
import { DmsReplicationSubnetGroup } from "@cdktf/provider-aws/lib/dms-replication-subnet-group";
Enter fullscreen mode Exit fullscreen mode

Define Constants:

const replicationSubnetGroup = new DmsReplicationSubnetGroup(
    stacks.infra,
    "MyReplicationSubnetGroup",
    {
      replicationSubnetGroupDescription: "MyReplicationSubnetGroup",
      replicationSubnetGroupId: "my-replication-subnet-group1",
      subnetIds: _app.privateSubnetIds,
    }
  );
Enter fullscreen mode Exit fullscreen mode

Specify the Subnet:

replicationSubnetGroupId: replicationSubnetGroup.id
Enter fullscreen mode Exit fullscreen mode

Additional Resources:
For further guidance, refer to the following documents:

[+] Creating a replication instance - https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReplicationInstance.Creating.html
[+] aws dms - create-replication-instance
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dms/create-replication-instance.html

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more