ReplicationSubnetGroup

class ReplicationSubnetGroup : KotlinCustomResource

Provides a DMS (Data Migration Service) replication subnet group resource. DMS replication subnet groups can be created, updated, deleted, and imported.

Note: AWS requires a special IAM role called dms-vpc-role when using this resource. See the example below to create it as part of your configuration.

Example Usage

Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.dms.ReplicationSubnetGroup;
import com.pulumi.aws.dms.ReplicationSubnetGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ReplicationSubnetGroup("example", ReplicationSubnetGroupArgs.builder()
.replicationSubnetGroupDescription("Example replication subnet group")
.replicationSubnetGroupId("example-dms-replication-subnet-group-tf")
.subnetIds(
"subnet-12345678",
"subnet-12345679")
.tags(Map.of("Name", "example"))
.build());
}
}

Creating special IAM role

If your account does not already include the dms-vpc-role IAM role, you will need to create it to allow DMS to manage subnets in the VPC.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.dms.ReplicationSubnetGroup;
import com.pulumi.aws.dms.ReplicationSubnetGroupArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var dms_vpc_role = new Role("dms-vpc-role", RoleArgs.builder()
.description("Allows DMS to manage VPC")
.assumeRolePolicy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Effect", "Allow"),
jsonProperty("Principal", jsonObject(
jsonProperty("Service", "dms.amazonaws.com")
)),
jsonProperty("Action", "sts:AssumeRole")
)))
)))
.build());
var exampleRolePolicyAttachment = new RolePolicyAttachment("exampleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
.role(dms_vpc_role.name())
.policyArn("arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole")
.build());
var exampleReplicationSubnetGroup = new ReplicationSubnetGroup("exampleReplicationSubnetGroup", ReplicationSubnetGroupArgs.builder()
.replicationSubnetGroupDescription("Example")
.replicationSubnetGroupId("example-id")
.subnetIds(
"subnet-12345678",
"subnet-12345679")
.tags(Map.of("Name", "example-id"))
.build(), CustomResourceOptions.builder()
.dependsOn(exampleRolePolicyAttachment)
.build());
}
}

Import

Replication subnet groups can be imported using the replication_subnet_group_id, e.g.,

$ pulumi import aws:dms/replicationSubnetGroup:ReplicationSubnetGroup test test-dms-replication-subnet-group-tf

Properties

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Description for the subnet group.

Link copied to clipboard

Name for the replication subnet group. This value is stored as a lowercase string. It must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens and cannot be default.

Link copied to clipboard
val subnetIds: Output<List<String>>

List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones.

Link copied to clipboard
val tags: Output<Map<String, String>>?

Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vpcId: Output<String>

The ID of the VPC the subnet group is in.