mirror of
https://github.com/floci-io/floci.git
synced 2026-12-06 11:38:06 -05:00
The Service Reference lists a tag key named after each DMS resource
type, dms:rep-tag/${TagKey} on a replication instance and
dms:endpoint-tag/${TagKey} on an endpoint, which Floci never filled, so
a condition on one never matched. The DMS User Guide says "The tag keys
are prefixed with "dms", the resource type, and the "tag" prefix", in
the format dms:{resource type}-tag/{tag key}, and that such a key
"matches a resource with the given tag".
A fetcher vendors that section of the guide. The request-resources
generator reads a key of the format the reference lists on a type as
that type's stored-tag prefix, leaving out dms:req-tag/, the request's
tags, and refusing a key listed on two types. It writes the format as
tagKeyFormats, which the reader checks those keys against.
The request-resources check now also runs when one of the vendored
sources its generator reads changes, several of which were missing from
the Makefile's paths and the drift workflow's triggers.
211 lines
15 KiB
Markdown
211 lines
15 KiB
Markdown
# AWS Database Migration Service (DMS)
|
|
|
|
**Protocol:** AWS JSON 1.1
|
|
**Signing name:** `dms`
|
|
|
|
Floci emulates the replication subnet group, endpoint, replication instance and
|
|
replication task lifecycles, which is what `aws_dms_replication_subnet_group`,
|
|
`aws_dms_endpoint`, `aws_dms_s3_endpoint`, `aws_dms_replication_instance` and
|
|
`aws_dms_replication_task` and `aws_dms_certificate` need to plan, apply and destroy. Subnets are resolved against
|
|
the emulated EC2 service, so the VPC and Availability Zones a group reports are the ones
|
|
those subnets actually have. No data is migrated: the resources are control-plane state.
|
|
|
|
## Supported Actions
|
|
|
|
<!-- floci:actions:start -->
|
|
| Action | Description |
|
|
| --- | --- |
|
|
| `CreateReplicationSubnetGroup` | Creates a replication subnet group from existing EC2 subnets. |
|
|
| `DescribeReplicationSubnetGroups` | Lists replication subnet groups, optionally filtered by identifier. |
|
|
| `DeleteReplicationSubnetGroup` | Deletes the specified replication subnet group. |
|
|
| `ListTagsForResource` | Lists the tags on one or more DMS resource ARNs. |
|
|
| `AddTagsToResource` | Merges tags into the resource, overwriting by key. |
|
|
| `RemoveTagsFromResource` | Removes the named tag keys from the resource. |
|
|
| `CreateEndpoint` | Creates a source or target endpoint; secret members are accepted and never returned. |
|
|
| `DescribeEndpoints` | Lists endpoints, filtered by `endpoint-arn`, `endpoint-type`, `endpoint-id` or `engine-name`. |
|
|
| `ModifyEndpoint` | Updates an endpoint; settings structures merge unless `ExactSettings` is true. |
|
|
| `DeleteEndpoint` | Deletes an endpoint that no replication task uses. |
|
|
| `CreateReplicationInstance` | Creates a replication instance, `available` immediately. |
|
|
| `DescribeReplicationInstances` | Lists replication instances, filtered by `replication-instance-arn`, `replication-instance-id`, `replication-instance-class` or `engine-version`. |
|
|
| `ModifyReplicationInstance` | Updates a replication instance, applied immediately. |
|
|
| `DeleteReplicationInstance` | Deletes a replication instance that no replication task uses. |
|
|
| `CreateReplicationTask` | Creates a replication task between two existing endpoints on an existing instance, `ready` immediately. |
|
|
| `DescribeReplicationTasks` | Lists replication tasks, filtered by `replication-task-arn`, `replication-task-id`, `migration-type`, `endpoint-arn` or `replication-instance-arn`. |
|
|
| `ModifyReplicationTask` | Updates a replication task that is not running. |
|
|
| `DeleteReplicationTask` | Deletes a replication task that is not running. |
|
|
| `StartReplicationTask` | Moves a task to `running`. |
|
|
| `StopReplicationTask` | Moves a running task to `stopped`. |
|
|
| `ImportCertificate` | Imports a PEM certificate or an Oracle wallet. |
|
|
| `DescribeCertificates` | Lists certificates, filtered by `certificate-arn` or `certificate-id`. |
|
|
| `DeleteCertificate` | Deletes a certificate that no endpoint uses. |
|
|
<!-- floci:actions:end -->
|
|
|
|
## Behaviour
|
|
|
|
- The identifier is stored as a lowercase string, as AWS does, so a group created as
|
|
`MyGroup` is described and deleted as `mygroup`.
|
|
- `ReplicationSubnetGroupIdentifier` must not be `default` and is limited to 255
|
|
alphanumeric characters, periods, underscores, or hyphens.
|
|
- A group must cover at least two Availability Zones. Fewer returns
|
|
`ReplicationSubnetGroupDoesNotCoverEnoughAZs`, as AWS does.
|
|
- Subnets must exist and must all belong to one VPC. Otherwise `InvalidSubnet`.
|
|
- `SubnetGroupStatus` is immediately `Complete`, every subnet reports `Active`,
|
|
`SupportedNetworkTypes` is `["IPV4"]`, and `IsReadOnly` is always `false`: a read-only
|
|
group is one DMS manages for a zero-ETL integration, which Floci does not emulate.
|
|
- The `default` group is synthesised from the region's default-VPC subnets, and only
|
|
exists once `CreateReplicationInstance` has put an instance in it (an instance created
|
|
without `ReplicationSubnetGroupIdentifier`, or naming `default` explicitly, which is
|
|
accepted whenever the region has default subnets), as AWS creates it the first time it
|
|
is needed.
|
|
Until then it is neither listed nor found by the filter. Unlike AWS, it disappears again
|
|
once no instance in the region uses it.
|
|
- `DescribeReplicationSubnetGroups` supports the `replication-subnet-group-id` filter.
|
|
A filter naming a group that does not exist returns `ResourceNotFoundFault`, which is
|
|
how Terraform detects a group deleted outside its state.
|
|
- `DescribeReplicationSubnetGroups` paginates on `MaxRecords` and `Marker`. `MaxRecords`
|
|
defaults to 100 and must be between 20 and 100; a value outside that range is rejected
|
|
with `InvalidParameterValueException` rather than clamped, as AWS does. Results are
|
|
ordered by identifier and `Marker` is an opaque cursor that resumes after the last item
|
|
of the page, so a page stays resumable across groups created or deleted between
|
|
requests. `Marker` is returned
|
|
only when a further page exists, never on the last one.
|
|
- `ReplicationSubnetGroupDescription` is required, must not be blank, and must contain only
|
|
printable characters. A control character such as `0x01` returns
|
|
`InvalidParameterValueException`.
|
|
- A member of the wrong JSON type returns `SerializationException`, as AWS does, rather than
|
|
being coerced. That covers a `Tags` entry whose `Value` is an object, a filter whose
|
|
`Values` is not a list, a non-string element in `ResourceArnList`, `SubnetIds` or
|
|
`TagKeys`, and a non-string identifier. An absent member is still a parameter error,
|
|
not a serialization one.
|
|
- Groups are scoped per account and Region and persist through `StorageFactory`.
|
|
|
|
### Endpoints, replication instances, replication tasks and certificates
|
|
|
|
- Each resource gets an ARN of the form `arn:aws:dms:<region>:<account>:<type>:<id>`, where
|
|
`<type>` is `endpoint`, `rep`, `task` or `cert` and `<id>` is 26 characters of the base32
|
|
alphabet, or the request's `ResourceIdentifier` when one is given. Update and delete
|
|
calls address the resource by that ARN.
|
|
- Identifiers must begin with a letter, contain only ASCII letters, digits and hyphens,
|
|
and not end with a hyphen or contain two consecutive hyphens (63 characters for an
|
|
instance, 255 otherwise). A replication instance identifier is stored lowercase, as AWS
|
|
documents; endpoint and task identifiers keep their case. A duplicate identifier returns
|
|
`ResourceAlreadyExistsFault`.
|
|
- A describe whose `Filters` match nothing returns `ResourceNotFoundFault`, which the
|
|
Terraform provider reads as "gone". Without filters, no resources is an empty list.
|
|
Filter values compare case-insensitively. Describes paginate on `MaxRecords` and
|
|
`Marker` as subnet groups do.
|
|
- **Endpoints** are `active` from creation. `EndpointType` is accepted lowercase and returned
|
|
uppercase (`SOURCE`, `TARGET`), as AWS does. `SslMode` defaults to `none`. Engine settings
|
|
structures (`MySQLSettings`, `S3Settings` and the rest) are stored as sent and returned
|
|
as stored, except that every member the DMS model types as a secret (`Password`,
|
|
`SaslPassword`, `AuthPassword` and so on) is dropped, because DMS never returns them.
|
|
`ModifyEndpoint` merges a settings structure into the stored one member by member, or
|
|
replaces it when `ExactSettings` is true.
|
|
- **Replication instances** are `available` from creation and stay so through a modify. A
|
|
named `ReplicationSubnetGroupIdentifier` must exist (otherwise `ResourceNotFoundFault`)
|
|
and is returned as the full `ReplicationSubnetGroup` structure; without one the instance
|
|
reports the `default` group. Defaults: `AllocatedStorage` 50, `EngineVersion` `3.5.4`,
|
|
`PubliclyAccessible` true, `MultiAZ` false, `AutoMinorVersionUpgrade` true,
|
|
`NetworkType` `IPV4`, `AvailabilityZone` `<region>a`. `ModifyReplicationInstance` applies
|
|
every change at once whatever `ApplyImmediately` says.
|
|
- **Replication tasks** need existing source and target endpoints and an existing instance
|
|
(otherwise `ResourceNotFoundFault`). `TableMappings` and `ReplicationTaskSettings` must be
|
|
JSON objects and are returned exactly as sent. A task is `ready` from creation;
|
|
`StartReplicationTask` makes it `running` and `StopReplicationTask` makes it `stopped`.
|
|
Stopping a task that is not running returns `InvalidResourceStateFault` with "is
|
|
currently not running", the message the Terraform provider treats as already stopped.
|
|
Modifying or deleting a running task returns `InvalidResourceStateFault`.
|
|
- **Certificates** are imported from `CertificatePem` or `CertificateWallet`; a request with
|
|
neither returns `InvalidParameterValueException`. A PEM is parsed as an X.509 certificate,
|
|
so `ValidFromDate`, `ValidToDate` and `SigningAlgorithm` are the certificate's own, and
|
|
`KeyLength` is reported for an RSA key only, as AWS does. A PEM that holds no certificate,
|
|
a blank one included, returns `InvalidCertificateFault`. For a bundle, the first
|
|
certificate is the one described. A wallet is stored and returned as sent; given both a
|
|
PEM and a wallet, AWS keeps only the PEM, and so does Floci. `CertificateOwner` is the
|
|
caller's account. Deleting a certificate that an endpoint's `CertificateArn` names returns
|
|
`InvalidResourceStateFault`, and `DeleteCertificate` given anything other than a
|
|
certificate ARN returns `InvalidParameterValueException`. These behaviours were checked
|
|
against a live AWS account.
|
|
- Deleting an endpoint or instance that a task references, or a subnet group that an
|
|
instance uses, returns `InvalidResourceStateFault`. A delete returns the resource with
|
|
status `deleting`, and it is gone from the next describe.
|
|
|
|
### Tagging
|
|
|
|
`Tags` on every create are stored with the resource, and the tagging trio works against
|
|
the resource's ARN. For a subnet group that is
|
|
`arn:aws:dms:<region>:<account>:subgrp:<identifier>`; DMS does not return that ARN from
|
|
`DescribeReplicationSubnetGroups`, so Terraform builds it client side and Floci parses it
|
|
back the same way. Endpoints, instances, tasks and certificates are tagged through the ARN their create
|
|
returned.
|
|
|
|
- `AddTagsToResource` merges by key, so re-tagging an existing key overwrites its value.
|
|
- `RemoveTagsFromResource` removes the named keys and ignores keys that are not present.
|
|
- `ListTagsForResource` accepts either `ResourceArn` or `ResourceArnList`. Each returned
|
|
tag carries its `ResourceArn` only for the `ResourceArnList` form, which is the form
|
|
AWS documents it on.
|
|
- Tag keys are 1 to 128 characters, values at most 256, and neither may start with `aws:`
|
|
or `dms:`.
|
|
- With [IAM enforcement](iam.md#iam-enforcement-mode) on, a resource's stored tags fill
|
|
`aws:ResourceTag/<key>` and the key the DMS User Guide names after its resource type,
|
|
`dms:{resource type}-tag/{tag key}`: `dms:endpoint-tag/<key>`, `dms:rep-tag/<key>` for a
|
|
replication instance, `dms:task-tag/<key>`, `dms:cert-tag/<key>` and `dms:subgrp-tag/<key>`,
|
|
for the five types Floci serves. The Service Reference names such a key for the other DMS types
|
|
too (`dms:data-provider-tag/<key>` and the rest), which Floci does not serve, so those keys hold
|
|
nothing. `dms:req-tag/<key>`, the tags a request applies, is not read yet.
|
|
- An ARN that is unparseable, names a different DMS resource type, names another account
|
|
or Region, or names a group that does not exist returns `ResourceNotFoundFault`. Tagging
|
|
is not a cross-account or cross-Region operation on AWS and is not one here either.
|
|
- Deleting a resource deletes its tags with it.
|
|
|
|
### IAM enforcement
|
|
|
|
With IAM enforcement on, each action is checked on the resources the AWS Service Authorization
|
|
Reference lists for it, read from the request. The reference ends each DMS type's ARN format in a
|
|
wildcard where the resource goes (`arn:aws:dms:<region>:<account>:endpoint:*`); the DMS User Guide
|
|
gives what goes there (`arn:aws:dms:region:account number:resourcetype:resourcename`), and Floci
|
|
reads each format that way. So a request naming an endpoint, a replication instance or a task by its
|
|
ARN, and the tagging calls, are checked on that ARN. A request naming a resource by its identifier
|
|
is checked on the resource Floci finds under it: an endpoint's, an instance's or a task's ARN ends
|
|
in an id DMS mints, not in the identifier, and a subnet group's ends in its identifier. A create of
|
|
an endpoint, a replication instance or a certificate is checked with that id open (`rep:*`), as AWS
|
|
answers it with an ARN its request does not give; a subnet group or event subscription create is
|
|
checked on the name its request gives, which its ARN ends in. An identifier that names nothing Floci
|
|
holds, such as the new name a modify gives, is checked on the ARN it would give. A request leaving
|
|
out an optional ARN, such as a `CreateEndpoint` with no `CertificateArn`, names the certificate DMS
|
|
uses for one naming none, and DMS has none; a replication instance whose create names no subnet
|
|
group is checked on the account's `default` subnet group, which DMS puts it in. A condition on
|
|
`aws:ResourceTag` reads the tags of an endpoint, an instance, a task, a certificate or a subnet group.
|
|
|
|
## Limitations
|
|
|
|
- **No migration runs.** A started task stays `running` until stopped; a full-load task
|
|
never finishes on its own, and `ReplicationTaskStats`, `StopReason` and
|
|
`LastFailureMessage` are not reported.
|
|
- **Values AWS fills in are not invented.** An endpoint does not report
|
|
`EngineDisplayName`, `ExternalId` or the settings structure AWS derives from top-level
|
|
connection fields, and a task without `ReplicationTaskSettings` reports none rather than
|
|
the AWS defaults. Instances report no private or public IP addresses.
|
|
- **`CdcStartTime` is ignored.** `CreateReplicationTask`, `ModifyReplicationTask` and
|
|
`StartReplicationTask` accept it, but it is not stored or returned. `CdcStartPosition` and
|
|
`CdcStopPosition` are stored by create and modify, and ignored by `StartReplicationTask`.
|
|
- **Not implemented:** `TestConnection`, `DescribeConnections`, `MoveReplicationTask`,
|
|
`DescribeEndpointTypes`, `DescribeOrderableReplicationInstances`, replication configs
|
|
(`aws_dms_replication_config`, serverless DMS), event subscriptions and the
|
|
`WithoutSettings` flag of `DescribeReplicationTasks`.
|
|
- **No `ModifyReplicationSubnetGroup`.** A subnet change has to be a delete and recreate.
|
|
- **Certificates are X.509 only.** AWS also accepts a PEM holding an encrypted private key
|
|
(`-----BEGIN ENCRYPTED PRIVATE KEY-----`); Floci returns `InvalidCertificateFault` for it.
|
|
- **An endpoint's `CertificateArn` is not checked.** AWS rejects a `CreateEndpoint` naming a
|
|
certificate that does not exist with `InvalidParameterValueException`; Floci accepts any
|
|
value, as it did before certificates could be imported, so existing setups that name a
|
|
placeholder ARN keep working.
|
|
|
|
See the [AWS DMS API Reference](https://docs.aws.amazon.com/dms/latest/APIReference/Welcome.html).
|
|
|
|
## Configuration
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `FLOCI_SERVICES_DMS_ENABLED` | `true` | Enable or disable DMS |
|