Your Company is using an AWS CodeDeploy for deployment of applications to EC2 instance.
For a financial application project to be deployed in the us-east region, log files are saved in the EC2 instance launched in this region.
A new joinee mistakenly deleted the deployment log file for AWS CodeDeploy.
Which of the following can be done to create a new log file?
Click on the arrows to vote for the correct answer
A. B. C. D.Correct Answer - C.
If a deployment log file is deleted, a new log file can be created by restarting the CodeDeployAgent service using the following commands,
For Windows,
o powershell.exe -Command Restart-Service -Name codedeployagent.
For Linux.
o sudo service codedeploy-agent stop.
o sudo service codedeploy-agent start.
Option A is incorrect as AWS CodeDeploy does not create a replacement file automatically.
Option B is incorrect as this is not a valid option for creating a new log file for AWS CodeDeploy.
Option D is incorrect as Restarting the EC2 instance will impact all services running on that instance.
For more information on AWS CodeDeploy Error codes, refer to the following URL-
https://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-ec2-instances.htmlOption A is not correct. AWS CodeDeploy does not automatically create a new log file if the existing one is deleted.
Option B is a valid solution if backups were taken regularly and a backup of the log file is available. However, if no backup was taken, this option cannot be used.
Option C is also not correct. Restarting the CodeDeployAgent service will not create a new log file. It will only restart the service and it may start logging new data, but the previously deleted log file will not be recovered.
Option D is the correct solution. Restarting the EC2 instance with the AWS CodeDeploy agent will create a new log file. This is because the AWS CodeDeploy agent logs to a file located on the EC2 instance where the agent is running. When the instance is restarted, the agent will start logging again to a new file.
Therefore, the correct answer is D - Restart EC2 instance with AWS CodeDeploy agent.