You are planning on deploying an application to the worker role in Elastic Beanstalk.
Moreover, this worker application is going to run the periodic tasks.
Which of the following is a must-have as part of the deployment?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - B.
This is also given in the AWS Documentation.
Create an Application Source Bundle.
When you use the AWS Elastic Beanstalk console to deploy a new application or an application version, you'll need to upload a source bundle.
Your source bundle must meet the following requirements.
Consist of a single ZIP file or WAR file (you can include multiple WAR files inside your ZIP file)
Not exceed 512 MB.
Not include a parent folder or top-level directory (subdirectories are fine)
If you want to deploy a worker application that processes periodic background tasks, your application source bundle must also include a cron.yaml file.
For more information, see Periodic Tasks.
Because of the exact requirement given in the AWS Documentation, all other options are invalid.
For more information on creating an application source bundle for Elastic beanstalk, please refer to the below URL-
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-sourcebundle.htmlThe correct answer is B. A cron.yaml file.
Elastic Beanstalk is an AWS service that simplifies the deployment and management of web applications. Elastic Beanstalk provides different environments, including web server environments and worker environments. The web server environment is used for hosting web applications, while the worker environment is used for running background tasks.
In Elastic Beanstalk, a cron job is a task that runs periodically at a specified interval. A cron job can be used for different purposes, such as sending emails, updating databases, or running backups.
To run a periodic task in a worker environment, you need to create a cron.yaml file. The cron.yaml file specifies the schedule for the cron job and the command to execute. The syntax for the cron.yaml file is similar to the syntax used in Linux systems.
The cron.yaml file must be placed in the root directory of your application. When Elastic Beanstalk deploys your application to the worker environment, it reads the cron.yaml file and creates a cron job based on the schedule and command specified in the file.
An appspec.yaml file is used for the deployment of web server environments in Elastic Beanstalk. It specifies the instructions for deploying your application, such as copying files, running scripts, and creating resources. It is not required for worker environments.
A cron.config file does not exist in Elastic Beanstalk. It is not a valid file name for any configuration file.
An appspec.json file is an alternative to the appspec.yaml file. It is also used for the deployment of web server environments, but it is not required for worker environments.
In summary, if you want to run periodic tasks in an Elastic Beanstalk worker environment, you need to create a cron.yaml file in the root directory of your application.