1

I have a script that creates a new instance from a snapshot, adding it to my security group, setting the master password and setting it to be publicly available

At each stage of the process I use: aws rds wait db-instance-available --db-instance-identifier MY_IDENTIFIER

The final part of the script needs to connect to the server and run a sql script against the data, but at this point it fails with:

ERROR 1045 (28000): Access denied for user '[email protected]' (using password: YES)

I know that the connection string is correct as (some time later), I am able to use it and connect without issue!

I read the "Troubleshooting for Amazon RDS" guide and can confirm that I have not missed anything, and besides, the fact that it does connect after some delay proves I have the correct settings.

The document points out that the state is set to 'creating' and then set to 'available' when each action is complete - I expect my wait statements to wait until this point.

I wonder if after being 'available' it then initiates a further change? Has anyone experienced this?

3
  • 1
    Hey Barnaby, try 'aws rds wait db-instance-available --db-instance-identifier MY_IDENTIFIER sleep 60 # Wait for an additional minute (you can adjust this time as needed)' Commented Oct 15, 2023 at 7:47
  • 1
    Yes sleep for ten minutes on the next line works! Thank you! Make it an answer and I will mark it as solved :-) Commented Oct 16, 2023 at 11:11
  • Happy to know that :-) Commented Oct 16, 2023 at 11:29

1 Answer 1

1

The aws rds wait db-instance-available command waits until the DB instance reaches the 'available' state. However, it doesn't necessarily guarantee that all changes to the instance (such as security group updates) have completed or taken effect.
After waiting for the DB instance to become 'available,' add some additional wait time before attempting to connect to the instance and run SQL scripts. This allows more time for the changes to propagate.

aws rds wait db-instance-available --db-instance-identifier MY_IDENTIFIER sleep 60 # Wait for an additional minute (you can adjust this time as needed) 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.