Where are AWS CodeDeploy Deployment logs found?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When a CodeDeploy deployment fails, the fastest path to an answer is usually on the target machine, not in the console. CodeDeploy keeps several different logs: agent logs, deployment lifecycle logs, and script output logs, and each answers a slightly different troubleshooting question.
Start with the Agent Log
On Linux-based EC2 and on-premises instances, the CodeDeploy agent writes its rotating logs under:
The current log is usually:
On Windows, the default agent log directory is:
This log is the right place to look when the agent itself is unhealthy, cannot download a revision, loses permissions, or has service-level problems before your deployment hooks even begin.
Deployment Logs vs Script Logs
CodeDeploy also stores deployment-specific files in its deployment root directory. On Linux, the default root is:
A useful aggregated deployment log is:
That file compiles lifecycle activity across deployments and is often the first place to look when a deployment hook failed but the agent itself was running.
For a specific deployment, CodeDeploy also keeps a per-deployment scripts.log inside the deployment folder. On Linux, the pattern is:
That file contains stdout and stderr from the AppSpec hook scripts such as BeforeInstall, AfterInstall, and ApplicationStart.
Finding the Right Deployment Folder
If you do not know the deployment ID, start in the console or the CLI and identify the failing deployment first. Then navigate into the matching folder on the instance.
The scripts.log file is often the most useful artifact when your shell script, service restart, permission fix, or package install failed. The aggregated deployment log tells you which lifecycle event failed; scripts.log tells you what the script actually printed.
Example Troubleshooting Flow
On a Linux instance, a practical first pass is:
Use those in that order:
- agent log for service or transport problems
- deployment log for lifecycle context
- '
scripts.logfor hook output and real application errors'
What About Lambda Deployments
If you are using CodeDeploy with Lambda, the model is different. There is no CodeDeploy agent on an instance, so you will not find EC2-style deployment folders. In that case, deployment events live in the CodeDeploy service and function execution logs live in CloudWatch Logs for the Lambda function versions and aliases involved.
That is why answers about CodeDeploy log locations often sound inconsistent: the storage location depends on the deployment target type.
Console View vs Machine Logs
The CodeDeploy console is still useful because it tells you which lifecycle event failed and on which instance. But it is usually not the final answer. Once the console identifies the failure point, the machine-side logs explain whether the real cause was a shell error, permission problem, missing file, or an agent communication issue.
Common Pitfalls
- Looking only in the CodeDeploy console and missing the richer logs stored on the target instance.
- Reading the agent log when the real failure is in
scripts.logfrom an AppSpec lifecycle hook. - Forgetting that Linux and Windows use different default log directories.
- Searching for EC2-style logs when the deployment target is Lambda, where the logging model is different.
- Ignoring deployment IDs and reading the wrong archived deployment folder.
Summary
- On Linux, the CodeDeploy agent log is under
/var/log/aws/codedeploy-agent/. - Deployment-specific Linux logs live under
/opt/codedeploy-agent/deployment-root/. - '
codedeploy-agent-deployments.loggives lifecycle context, whilescripts.logshows hook script output.' - On Windows, use
C:\ProgramData\Amazon\CodeDeploy\as the main starting point. - For Lambda deployments, look to CodeDeploy events and CloudWatch Logs instead of instance-side agent folders.

