1 Risposta
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
0
To run a cron job that connects to an RDS database from an Elastic Beanstalk application, you can use a .ebextensions configuration file.
Place a file such as 01_cronjob.config in a .ebextensions directory at the root of your application source code.
The file should contain:
files:
"/etc/cron.d/cronjob" :
mode: "000644"
owner: root
group: root
content: |
*/5 * * * * root cd /var/app/current && ./script.sh >> /var/log/cronjob.log 2>&1
This will run the script.sh file inside your application directory every 5 minutes.
The script can then connect to the RDS database using the RDS_HOSTNAME, RDS_USERNAME, RDS_PASSWORD environment variables provided by Elastic Beanstalk.
Make sure to grant access to the security group of your EC2 instances to connect to the RDS port from its IP range.
Contenuto pertinente
- AWS UFFICIALEAggiornata 4 mesi fa
- AWS UFFICIALEAggiornata un anno fa
- AWS UFFICIALEAggiornata 8 mesi fa