Package com.pulumi.aws.dms
Class ReplicationSubnetGroup
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.dms.ReplicationSubnetGroup
-
public class ReplicationSubnetGroup extends com.pulumi.resources.CustomResource
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 ```java 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. ```java 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 Using `pulumi import`, import replication subnet groups using the `replication_subnet_group_id`. For example: ```sh $ pulumi import aws:dms/replicationSubnetGroup:ReplicationSubnetGroup test test-dms-replication-subnet-group-tf ```
-
-
Constructor Summary
Constructors Constructor Description ReplicationSubnetGroup(java.lang.String name)
ReplicationSubnetGroup(java.lang.String name, ReplicationSubnetGroupArgs args)
ReplicationSubnetGroup(java.lang.String name, ReplicationSubnetGroupArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ReplicationSubnetGroup
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ReplicationSubnetGroupState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
replicationSubnetGroupArn()
com.pulumi.core.Output<java.lang.String>
replicationSubnetGroupDescription()
com.pulumi.core.Output<java.lang.String>
replicationSubnetGroupId()
com.pulumi.core.Output<java.util.List<java.lang.String>>
subnetIds()
com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>
tags()
com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>
tagsAll()
com.pulumi.core.Output<java.lang.String>
vpcId()
-
-
-
Constructor Detail
-
ReplicationSubnetGroup
public ReplicationSubnetGroup(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
ReplicationSubnetGroup
public ReplicationSubnetGroup(java.lang.String name, ReplicationSubnetGroupArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
ReplicationSubnetGroup
public ReplicationSubnetGroup(java.lang.String name, ReplicationSubnetGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
replicationSubnetGroupArn
public com.pulumi.core.Output<java.lang.String> replicationSubnetGroupArn()
-
replicationSubnetGroupDescription
public com.pulumi.core.Output<java.lang.String> replicationSubnetGroupDescription()
- Returns:
- Description for the subnet group.
-
replicationSubnetGroupId
public com.pulumi.core.Output<java.lang.String> replicationSubnetGroupId()
- Returns:
- 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`.
-
subnetIds
public com.pulumi.core.Output<java.util.List<java.lang.String>> subnetIds()
- Returns:
- List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- 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.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
-
vpcId
public com.pulumi.core.Output<java.lang.String> vpcId()
- Returns:
- The ID of the VPC the subnet group is in.
-
get
public static ReplicationSubnetGroup get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ReplicationSubnetGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-