← ResourcesDEVOPS Β· AUDIT

Audit and traceability of infrastructure changes

Audit sources, log correlation and regulatory compliance to know who changed what, and when.

STRALYA18 min readAugust 2026

Why every infrastructure change should be audited

Auditing infrastructure changes is not an administrative formality but an operational and regulatory necessity. Once a cloud infrastructure grows past the artisanal stage, every change has a potential impact on production and can affect security, availability, and compliance. Without an audit, a simple update to an AWS security group, a change to a Terraform configuration, or a redeployment can create inconsistencies, leave lost traces, or worse, make it impossible to reconstruct an incident in a post-mortem. Scale-up and mid-market teams know this problem well: an incident occurs, and no one can say with certainty who deployed which version, when, or what changes were applied between the stable version and the moment of the crash. Systematically auditing every change solves three major challenges. First, regulatory compliance: frameworks such as ISO 27001, SOC 2, and sector-specific directives (GDPR, NIS2, etc.) require documented traceability of changes. Second, operational accountability: being able to identify precisely who deployed what makes it possible to attribute errors clearly and learn collectively. Finally, incident forensics: when an anomaly occurs, the change audit is often the first lead for isolating the root cause. Without it, the team gets lost in guesswork and wastes precious time.

Audit sources in a cloud infrastructure

A modern AWS infrastructure naturally produces logs and events with every change, but gathering and interpreting them requires a clear strategy. AWS CloudTrail is the foundation: it records every API call made on your AWS account, whether it comes from the console, a CLI, an SDK, or an AWS service itself. CloudTrail captures the identity of the principal (IAM user, role, or service), the exact timestamp, the call parameters, and the result (success or error). For a deployment or an infrastructure change, this means that every CreateSecurityGroup, ModifyDBInstance, UpdateAutoScalingGroup, or PutBucketEncryption action leaves an immutable trace. But CloudTrail alone is not enough: it records raw API calls, not business context. If an engineer uses Terraform to deploy a new version of an application, CloudTrail will see the resulting API calls (for example, CreateAutoScalingGroup), but not the fact that this was an intentional deployment of a new version. This is why you must correlate CloudTrail with the logs of your deployment tools (CI/CD, orchestration, infrastructure-as-code). Jenkins, GitLab CI, GitHub Actions, or any release pipeline tool must record every execution: who triggered the pipeline, on which branch or tag, with which parameters, and what the result was. If you use Terraform, the Terraform execution logs must also be centralized, ideally with versioned state and auditability of the changes applied to the state. For runtime configurations (environment variables, secrets, configuration files), tools such as AWS Systems Manager Parameter Store, AWS Secrets Manager, or a dedicated configuration store like Consul make it possible to track modifications and accesses. Finally, inside servers and containers, system logs (systemd journal, container logs) and application logs must also flow up to confirm that the expected configuration was indeed applied and remains in place.

Centralizing and correlating audit logs

Collecting logs at the source is one thing, making use of them is another. A distributed infrastructure on AWS quickly generates thousands of logs per hour: CloudTrail, ELB access logs, Lambda logs, ECS task logs, RDS logs, and so on. Leaving these logs in their respective silos (CloudTrail in S3, CloudWatch for applications, etc.) makes practical auditing impossible: you cannot quickly answer a question like "what are all the changes made to this database over the last two hours?" or "who modified this network security rule?" because you have to dig manually through each source. The solution is to centralize all relevant audit logs in a single log management system, ideally immutable and with long retention (at least 1 to 3 years depending on regulatory obligations). AWS CloudWatch Logs can serve as a central collector: you send CloudTrail to it via EventBridge, your CI/CD pipeline logs by integrating an agent or a webhook, your infrastructure-as-code logs by parsing the log files, and so on. Beyond simple centralization, you must correlate events to tell a complete story. A concrete example: Alice launches a deployment via GitLab CI to migrate a database to a new RDS instance. Here is what happens: (1) GitLab records that the pipeline started at 14:22 by the user alice, branch main, commit abcd1234. (2) GitLab runs a Terraform apply job, which emits Terraform logs showing that ModifyDBInstance and CreateDBSnapshot were launched. (3) CloudTrail records two API calls: ModifyDBInstance by principal alice and CreateDBSnapshot at the same timestamp. (4) RDS produces logs indicating that the migration started and completed. For an auditor or an engineer running an incident post-mortem, being able to see this entire chain (from commit to AWS API through the pipeline) is infinitely more useful than reading CloudTrail alone, which would simply say "ModifyDBInstance API launched." To correlate effectively, instruct your pipelines to include common metadata (commit hash, pipeline ID, user ID) in the logs or even in the tags of the AWS resources. AWS CloudTrail can include resource tags in its records, and EventBridge allows you to enrich events. Commercial log management solutions such as Datadog, New Relic, Splunk, or open-source solutions such as ELK (Elasticsearch, Logstash, Kibana) or Loki make complex correlation and search over this metadata easier.

Implementing access and integrity controls

An audit is only valuable if it cannot be tampered with. If a malicious or compromised engineer can modify or delete the logs after a problematic change, the audit becomes useless. This is why you must put strict access and integrity controls in place. At the AWS level, CloudTrail itself offers protections: logs can be written to an S3 bucket with restrictive permissions (no one can delete them, only add to them), with versioning and MFA Delete enabled for an extra layer. CloudTrail can also validate log integrity via digest signatures, which makes it possible to detect whether a log file has been modified after it was written. These AWS mechanisms are sufficient for most use cases, but for strict regulatory compliance (for example, SOC 2, NIS2), you can also use AWS WORM (Write Once Read Many) or send the logs to a third-party system that has its own immutability protocol. On the pipeline and infrastructure change side, access control must be granular: who is allowed to launch a production deployment? Who can approve a merge request that touches the infrastructure? Who can modify secrets or sensitive configurations? These decisions must be recorded in your audit system as well. Best practices include: (1) using multi-factor authentication (MFA) for all administrative access, including webhooks and API tokens; (2) implementing separation of duties, where a production deployment requires approval from another person (code review plus approval for the merge, then a separate approver for the deployment if possible); (3) recording in CloudTrail (or your audit system) not only who launched the change, but also who approved it; (4) using temporary AWS roles (STS roles) rather than long-lived access keys, so that even in the event of a compromise, the session is time-limited. For centralized logging systems, access controls must also restrict who can view the audit: a standard developer does not need access to the logs of all secrets or network security changes. Use role-based access control (RBAC) or attribute-based access control (ABAC) to limit the exposure of sensitive data in the logs.

Tooling drift detection through the audit

Auditing intentional changes is one thing, but a real infrastructure also experiences drift: someone modifies a parameter manually in the AWS console instead of going through Terraform, a silent deployment library makes an unexpected change, or a configuration expires and is not renewed. The change audit must therefore integrate with drift detection to identify and alert on discrepancies. AWS Config provides a basis for this: it records the state of AWS resources at a point in time, and can compare that state to the previous state to detect changes. When a resource changes (for example, a security group is modified), Config emits an event that can trigger a Lambda or an alert. By combining Config with CloudTrail, you can answer the question "the config changed, who did it and why?" If the change was intentional (for example, through an approved deployment pipeline), the audit will confirm it and mark the drift as acceptable. If the change appeared without a clear audit trail (no one can justify an intentional change), that is a warning signal: the drift is unintentional. For infrastructures using Terraform or CloudFormation, Terraform Cloud / Terraform Enterprise offers native visibility: every run (plan, apply) is recorded, and you can see exactly which drift was corrected by which apply. CloudFormation Drift Detection does the same: it compares the actual AWS state with the CloudFormation stack and flags resources that are outside the definition. Automating drift remediation with these tools also means automatically recording who authorized the correction (for example, an approver who clicked the "Approve" button in Terraform Cloud). Integrating these detections into a centralized audit system lets you build a timeline: which drifts were detected, when, who approved and corrected them, and what the state was before and after. This considerably simplifies compliance: an external auditor can see that drift is systematically detected and corrected through an audited process, rather than discovering stray configurations that are documented nowhere.

Automating post-incident investigations with the audit

When an incident occurs in production (downtime, data loss, security breach), one of the first questions is always: what changed before this? The team must quickly identify which deployment, which configuration change, or which network incident caused the problem. With a complete, centralized audit, this investigation becomes automated rather than manual. Take a concrete example: on November 15 at 14:30, your API becomes slow. You launch an investigation. Without an audit, you have to: (1) manually ask each team whether someone deployed something, (2) consult the logs of each system separately, (3) guess which change might be responsible. With the audit, you can: (1) query your centralized system and ask "what infrastructure changes took place between 14:00 and 14:45?" in a single query; (2) immediately see that Alice deployed a new version of the database at 14:15 and Bob increased the number of ElastiCache replicas at 14:20; (3) correlate with performance metrics and application logs to isolate which of these changes caused the slowness. To automate even further, monitoring and observability tools such as Datadog, New Relic, or Grafana can integrate audit data ("who deployed what") as annotations on performance charts. You will see, directly on the latency chart, the vertical line marking the deployment, which accelerates the intuition of the root cause. Incident post-mortems become faster and more accurate: instead of debating what happened, you have a factual timeline. Finally, for security incidents, the audit is essential for forensics: if your database was exposed, you must be able to establish exactly who accessed it, when, from where, and whether that access was authorized. CloudTrail and the database access logs (RDS audit logs, DynamoDB streams, etc.) must all flow up to a secure, immutable system so they cannot be deleted by an attacker.

Regulatory compliance and audit reports

For scale-ups and mid-market companies operating on AWS, regulatory compliance is no longer optional: large-account clients ask for compliance attestations (ISO 27001, SOC 2 type 2), regulated sectors impose standards (GDPR, NIS2, PCI DSS for finance or online sales), and service contracts include clauses on traceability and accountability. Auditing infrastructure changes is a cornerstone of demonstrating this compliance. SOC 2 type 2 specifically requires a demonstration that changes are approved, documented, and traceable. ISO 27001 requires an inventory of modifications and formal change management. NIS2 mandates logging of security events and the ability to investigate incidents. GDPR requires being able to state who accessed personal data and when. A centralized, automated, and immutable audit of all infrastructure changes makes it possible to meet all these criteria without major administrative overhead. For audit reports, your system must be able to quickly generate: (1) a list of all infrastructure changes over a given period, by whom and approved by whom; (2) a demonstration that production changes followed a formal approval process (code review, testing, approval before deployment); (3) traceability of security changes (network security rules, IAM configurations, secrets); (4) proof of immutability of the audit logs (that they cannot be modified retroactively); (5) a demonstration of separation of duties (no one deploys alone to production without approval). Commercial audit systems (Datadog Compliance, New Relic, etc.) offer report templates for common standards, which speeds up the generation of compliance evidence. Even with open-source solutions, a well-audited infrastructure is an asset for external audits. Finally, retaining these audit records over time (for example, 3 years minimum) is often mandatory, so your log retention strategy must also be documented and followed.

Progressive rollout: where to start

Implementing an exhaustive audit of infrastructure changes does not have to be a months-long project. Most organizations start with the fundamentals and expand progressively. A simple first step: enable CloudTrail (if it is not already) across your entire AWS account and configure it to write the logs to a secure S3 bucket. CloudTrail is free for recording; only the S3 storage costs a fraction of a cent. This immediately gives you traceability of all AWS changes. Next, integrate your CI/CD logs: configure your pipeline (Jenkins, GitLab CI, GitHub Actions, etc.) to emit a webhook or a log to CloudWatch or Splunk on every production deployment, including who launched it, which commit, and what result. This is often just a few lines of configuration. Third step, centralize these logs: use CloudWatch Logs or a solution like ELK if you want more flexibility. Configure CloudTrail to write to CloudWatch, have your pipelines send logs to the same destination, and you have a single hub. Fourth step, set up simple alerts: when an infrastructure change occurs without a clear audit trail (for example, a security group modification not audited by a pipeline), an alert must fire. AWS Config plus Lambda can do this. Fifth step (optional but recommended), integrate an observability monitoring solution to annotate performance charts with infrastructure changes. This dramatically improves the ability to investigate incidents. At each step, you can validate the effectiveness: are you able to answer the key questions (which changes, by whom, when, approved how)? Can you generate a basic compliance report? If so, move to the next step. This progressive approach minimizes operational disruption and the learning curve, while quickly demonstrating value.

Integration with automated rollback and recovery

An audit is not limited to recording what happened, but also to enabling traced corrective actions. When drift is detected or an incident is caused by a faulty deployment, the ability to perform a fast, safe rollback is critical. But this rollback itself must be audited: why was it triggered, who approved it, and what was the state before and after. Automating rollbacks also means automating their recording. If you use a blue-green deployment strategy (a "blue" set of servers runs in production, a "green" standby set is prepared with the new version, then traffic switches to green and blue becomes the standby), an automated rollback means switching traffic from green back to blue. This switch must be recorded in CloudTrail and your deployment logs: who or what mechanism ordered the rollback, at what time, and with what result. For Terraform, tools such as Terraform Cloud offer automated rollback after X minutes if health checks fail; the Terraform Cloud audit records who approved the initial plan and when the rollback triggered. AWS CodeDeploy, for its part, can automatically roll back if CloudWatch alarms fire during a deployment, and CloudTrail records this action. The simplest integration: configure your monitoring system (CloudWatch, Prometheus, etc.) so that alert thresholds trigger an explicit audit action (for example, a CloudWatch log "Automatic Rollback Triggered: Deployment ID X, Reason: High Error Rate, Timestamp: ..."). This creates a readable trace for forensics: instead of having to infer from the silence of the metrics that something went well, you have explicit confirmation that the system acted. For more advanced teams, tools such as OpenFeature or LaunchDarkly enable high-speed configuration changes (without redeployment) and trace every flag or configuration change, which accelerates rollback: rather than redeploying a previous version (costly), you can simply toggle a feature flag off, and this is audited as well.

AWS TEARDOWN Β· FREE

Get the AWS Teardown: where your bill really goes.

The guide listing the 12 cost areas that leak the most at scale-ups, and how to plug them. Free, by email, no strings attached.