DatabaseMigrationService.Waiter.TestConnectionSucceeds never works
See original GitHub issueUse case
We have some automation around DMS pipelines for a nightly dump of our databases. A small percentage of DMS tasks fail to start because the initial endpoint connection test fails. I’m attempting to handle this issue and re-test the connection before starting the task.
Expected behaviour
DatabaseMigrationService.Waiter.TestConnectionSucceeds
waits for a connection test in progress to succeeds and then returns
Actual behaviour
Errors out immediately with:
Waiter TestConnectionSucceeds failed: Connection is already being tested: WaiterError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 64, in lambda_handler
waiter.wait(ReplicationInstanceArn=replication_instance_arn, EndpointArn=source_endpoint_arn)
File "/var/runtime/botocore/waiter.py", line 53, in wait
Waiter.wait(self, **kwargs)
File "/var/runtime/botocore/waiter.py", line 313, in wait
last_response=response
botocore.exceptions.WaiterError: Waiter TestConnectionSucceeds failed: Connection is already being tested
I’m not too familiar with how boto waiters work, but it seems like this might just be calling the dms test-connection api, which returns the same error after it’s called a second time (while the connection is still testing
). I’ve reproduced a similar error by using the CLI directly:
$ aws dms test-connection --replication-instance-arn arn:aws:dms:us-east-1:*****:rep:65LSNAJCV7QHFPNWAZUHZ5DNHQ --endpoint-arn arn:aws:dms:us-east-1:*****:endpoint:TNS6FYCD4JYFMNUYLI2OCQJMPI
{
"Connection": {
"ReplicationInstanceArn": "arn:aws:dms:us-east-1:*****:rep:65LSNAJCV7QHFPNWAZUHZ5DNHQ",
"EndpointArn": "arn:aws:dms:us-east-1:*****:endpoint:TNS6FYCD4JYFMNUYLI2OCQJMPI",
"Status": "testing",
"EndpointIdentifier": "datatruck-scylla-nextaccounting-shards-read-replica-02-0116",
"ReplicationInstanceIdentifier": "datatruck-scylla-next-accounting-shard-0116"
}
}
$ aws dms test-connection --replication-instance-arn arn:aws:dms:us-east-1:*****:rep:65LSNAJCV7QHFPNWAZUHZ5DNHQ --endpoint-arn arn:aws:dms:us-east-1:*****:endpoint:TNS6FYCD4JYFMNUYLI2OCQJMPI
An error occurred (InvalidResourceStateFault) when calling the TestConnection operation: Connection is already being tested
Code
Here’s the relevant part of my python code:
replication_task = response['ReplicationTasks'][0]
replication_task_arn = replication_task['ReplicationTaskArn']
source_endpoint_arn = replication_task['SourceEndpointArn']
target_endpoint_arn = replication_task['TargetEndpointArn']
replication_instance_arn = replication_task['ReplicationInstanceArn']
logger.info(f"Testing connection between replication instance ${replication_instance_arn} and endpoint ${source_endpoint_arn}")
logger.info("Waiting for successful connection...")
waiter = client.get_waiter('test_connection_succeeds')
waiter.wait(ReplicationInstanceArn=replication_instance_arn, EndpointArn=source_endpoint_arn)
logger.info(f"Starting replication task '{replication_task_arn}' from source {source_endpoint_arn} to target {target_endpoint_arn} on {replication_instance_arn}")
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Waiters::TestConnectionSucceeds — AWS SDK for Ruby V3
A new instance of TestConnectionSucceeds. #wait(params = {}) ⇒ Types::DescribeConnectionsResponse. Returns a response object which responds to the ...
Read more >Release v1.16.24 (2019-01-23) - Google Git
Update for DMS TestConnectionSucceeds waiter. service/fms : Updates service API and ... removes // comments since that was never supported previously.
Read more >DatabaseMigrationService — Boto 3 Docs 1.9.185 ... - AWS
A low-level client representing AWS Database Migration Service: ... The name of the Amazon Redshift data warehouse (service) you are working with.
Read more >https://potsandpans.co.kr/plugin/aws_s3/CHANGELOG.md
API Documentation is also updated on https://docs.aws.amazon.com/chime/index.html * `Aws\DatabaseMigrationService` - Add waiters for TestConnectionSucceeds, ...
Read more >https://www.jardinetmaison.fr/sites/all/libraries/...
`Aws\DatabaseMigrationService` - Update for DMS TestConnectionSucceeds waiter * `Aws\FMS` - This release provides support for cleaning up web ACLs during ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m running into a similar issue with the the dms ReplicationTaskStopped waiter for both the AWS CLI and boto3.
I am running the following versions: boto3 (1.9.127) botocore (1.12.127) aws-cli/1.16.135
I always get the error “Waiter ReplicationTaskStopped failed: Waiter encountered a terminal failure state” unless the task is already in the “stopped” state. It returns this error even if the task is in the “starting” or “running” state which doesn’t seem correct.
@mwarkentin Thanks for the report. Definitions of waiters are shared between the Python SDK and the AWS CLI (and all of our SDKs, for that matter). I can confirm that this waiter is broken for the reason you describe. We’re working on getting this fixed. Labeling as a bug for now.