RDS Aurora php_network_getaddresses: getaddrinfo failed in ENTRYPOINT

0

I am using CloudFormation templates to deploy a PHP Laravel App in a Docker container to Fargate using an Aurora Serverless Cluster for database needs.

I assign the hostname of the Aurora Cluster to my container's environment in the TaskDefinition, and it shows up in the container like this:

my-app-auroraserverlesscluster-*-dbcluster-****.cluster-********.eu-central-1.rds.amazonaws.com

Once the CloudFormation update is through and everything is up and running, I can successfully connect to that database, and fire queries.

But during deployment - more specifically in the ENTRYPOINT script of my container, while trying to run my database migrations, I do consistently get the following error:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

I did try to set timeout:30 in /etc/resolve.conf, and I also tried to run the migration in a retry-loop for up to several minutes. But the error persists. Once the migration fails and the update completes, I can then successfully connect to the DB.

Both VPC and RDS Aurora finish their update BEFORE the update of the app starts.

2020-07-21 09:31:13 UTC+0200 AppService UPDATE_IN_PROGRESS
2020-07-21 09:31:12 UTC+0200 AppTarget UPDATE_COMPLETE
2020-07-21 09:31:11 UTC+0200 AppTarget UPDATE_IN_PROGRESS
2020-07-21 09:31:11 UTC+0200 AlbListenerHttp UPDATE_COMPLETE
2020-07-21 09:31:11 UTC+0200 AuroraServerlessCluster UPDATE_COMPLETE
2020-07-21 09:31:10 UTC+0200 AlbListenerHttp UPDATE_IN_PROGRESS
2020-07-21 09:31:10 UTC+0200 AuroraServerlessCluster UPDATE_IN_PROGRESS
2020-07-21 09:31:10 UTC+0200 Alb UPDATE_COMPLETE
2020-07-21 09:31:10 UTC+0200 AuroraServerlessClientSg UPDATE_COMPLETE
2020-07-21 09:31:10 UTC+0200 Alb UPDATE_IN_PROGRESS
2020-07-21 09:31:09 UTC+0200 AuroraServerlessClientSg UPDATE_IN_PROGRESS
2020-07-21 09:31:09 UTC+0200 Vpc UPDATE_COMPLETE
2020-07-21 09:30:59 UTC+0200 DatabaseSecret UPDATE_COMPLETE
2020-07-21 09:30:59 UTC+0200 DatabaseSecret UPDATE_IN_PROGRESS
2020-07-21 09:30:58 UTC+0200 Key UPDATE_COMPLETE
2020-07-21 09:30:58 UTC+0200 Key UPDATE_IN_PROGRESS
2020-07-21 09:30:58 UTC+0200 Vpc UPDATE_IN_PROGRESS
2020-07-21 09:30:57 UTC+0200 Cluster UPDATE_COMPLETE
2020-07-21 09:30:57 UTC+0200 Alerting UPDATE_COMPLETE
2020-07-21 09:30:57 UTC+0200 Cluster UPDATE_IN_PROGRESS
2020-07-21 09:30:57 UTC+0200 Alerting UPDATE_IN_PROGRESS

I am new to AWS and not sure how to do my migrations - but I am used to normally do them in the ENTRYPOINT, which does not seem possible to do in AWS?

How should I be doing database migrations?

hooby
asked 4 years ago1133 views
1 Answer
0

solution:
php artisan config:clear

I feel stupid now.

hooby
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions