DVA-C02 Question 220
Select 2You are tasked with deploying a Python-based web application to AWS Elastic Beanstalk. The application requires specific Python libraries listed in a 'requirements.txt' file. What steps should you take to prepare the application artifact for deployment?
- A
Bundle the application code along with the 'requirements.txt' file in a ZIP archive.
- B
Include a 'Procfile' in the application bundle to specify the application's entry point.
- C
Pre-install the Python libraries locally and include the installed packages folder in the ZIP archive.
- D
Ensure the application code is stored in a Git repository and deploy directly from Git.
- E
Define the runtime environment and dependencies in an 'environment.yml' file instead of 'requirements.txt' for Python.
Show answer and explanation
Correct answers: A, B
Explanation
To prepare a Python application for deployment to AWS Elastic Beanstalk, you must ensure that the application code and all necessary files, like 'requirements.txt', are included in a ZIP archive. Including a 'Procfile' is also recommended to specify the application's entry point. Elastic Beanstalk handles installing dependencies during deployment, so pre-installing them locally is unnecessary.
- A. Correct.
'Bundle the application code along with the 'requirements.txt' file in a ZIP archive.' is correct. Elastic Beanstalk requires the application source bundle to include all necessary files, including the 'requirements.txt' for installing dependencies.
- B. Correct.
'Include a 'Procfile' in the application bundle to specify the application's entry point.' is correct. A 'Procfile' is often used to define the command that starts the application, which is necessary for Elastic Beanstalk to run the application correctly.
- C. Incorrect.
'Pre-install the Python libraries locally and include the installed packages folder in the ZIP archive.' is incorrect. Elastic Beanstalk handles dependency installation via 'requirements.txt', so pre-installing libraries is not required.
- D. Incorrect.
'Ensure the application code is stored in a Git repository and deploy directly from Git.' is incorrect. While Elastic Beanstalk supports deployment from Git, it is not required to deploy from Git specifically. You can deploy using a ZIP bundle instead.
- E. Incorrect.
'Define the runtime environment and dependencies in an 'environment.yml' file instead of 'requirements.txt' for Python.' is incorrect. Elastic Beanstalk expects a 'requirements.txt' file for Python dependencies, not an 'environment.yml' file.