This code fragment fails:
Where _aws_session is a boto3.session.Session() instance:
rds_client = _aws_session.client('rds')
rds_client.modify_db_instance(DBInstanceIdentifier=rds_id, ApplyImmediately=True, NewDBInstanceIdentifier='{0}-temp'.format(rds_id))
rds_waiter = rds_client.get_waiter('db_instance_available')
rds_waiter.wait(DBInstanceIdentifier='{0}-temp'.format(rds_id)) OR
rds_waiter.wait(DBInstanceIdentifier=rds_id)
print("RDS Renamed!")
What happens is if I use the old RDS identifier or the new renamed one, the waiter assumes available even though the RDS is renaming/rebooting state. Is this a bug?
I am not sure. Based on the waiter's definition, it should only stop waiting (due to success) if all matching DB's have the available state and the renaming/rebooting state should not cause the waiter to throw an error. Could you provide the debug logs from running this waiter? To do so, just add boto3.set_stream_logger('botocore') to the line before you call wait.
The return state is 'Available' the problem is after its available the RDS goes to reboot which takes it out of Available.
I noticed the following state: Available --> Renaming --> Available --> Rebooting -> Available
There's no way to really know when the RDS is 'really' available at the end of the rename action being done. Instead the first 'available' response from AWS API will release the waiter where it really shouldn't.
We wrote a wrapper function that does a poll/wait to workaround this.
Yeah I am not sure if there is a great way around that other than what you did. It is essentially a limitation in the waiter specification, where once we hit a success state we stop waiting.
There is no current way to define "to make sure that this resource is in X state and will stay in X state, the waiter can stop waiting if Y consecutive calls have been made where the X state is returned" without revamping our design of waiters.
Because of this, I am relabeling this to a feature request.
hello @kyleknap
is there anything new about the status of this features request?
Hello,
is there anything new about the status of this features request?
This seems more like a bug than a feature request
Any updates?
Most helpful comment
hello @kyleknap
is there anything new about the status of this features request?