Elastic Beanstalk Worker Role: Must-Have for Periodic Task Deployment

Must-Have for Periodic Task Deployment

Prev Question Next Question

Question

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?

Answers

Explanations

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.html

The correct answer is B. A cron.yaml file.

When deploying an application to the worker role in Elastic Beanstalk, a cron.yaml file is a must-have as part of the deployment. This file is used to define periodic tasks that need to be run on the worker instances.

A cron job is a scheduled task that runs automatically at a specified interval. The cron.yaml file allows you to define these scheduled tasks, including the frequency and the command to be executed.

For example, suppose you have a task that needs to be run every hour. In that case, you can create a cron.yaml file that defines this task and the frequency at which it should be run. The file may look like this:

yaml
version: 1 cron: - name: hourly-task url: /task schedule: "0 * * * *"

This file specifies that the task named "hourly-task" should be run every hour. The task is executed by calling the URL "/task" on the worker instance.

It is worth noting that the appspec.yaml file is used for the deployment of web applications, not worker applications. The appspec.json file is not a valid file type for Elastic Beanstalk deployments, and the cron.config file does not exist. Therefore, options A, C, and D are incorrect.