AWS Security Hub has become a central pillar for organizations seeking continuous compliance and automated security posture management across their cloud estates. By aggregating findings from multiple AWS services and applying industryโstandard bestโpractice controls, Security Hub delivers a measurable security score that helps teams prioritize remediation efforts. One of the foundational controls, identified as SSM.6, focuses on Systems Manager Automation and specifically checks whether the output of aws:executeScript actions is being sent to CloudWatch Logs. While the control may appear narrow, its implications stretch far beyond a simple configuration toggle; it touches on auditability, incident response, and the ability to trust automated changes in production environments. In todayโs market, where infrastructureโasโcode and automated remediation are becoming the norm, ensuring that every automated action leaves a verifiable trail is no longer optionalโit is a baseline expectation for auditors, regulators, and security leaders alike. This article unpacks why SSM.6 matters, what risks arise when logging is disabled, and how to remediate the finding consistently across accounts and regions.
Systems Manager Automation allows administrators to define repeatable procedures, known as Runbooks, that orchestrate changes to AWS resources without manual intervention. Within a Runbook, the aws:executeScript action provides the flexibility to run Python, PowerShell, or other scripting languages directly against AWS APIs, enabling tasks such as dynamic tagging, configuration drift correction, or custom health checks. The power of this capability also introduces risk: if a script modifies resources in an unexpected way, or if a compromised credential is used to launch a malicious Runbook, the only way to understand what happened is to examine the scriptโs output. When CloudWatch Logs integration is enabled, every piece of stdout and stderr generated by aws:executeScript is automatically captured in a designated log group, creating a chronological record that can be searched, filtered, and retained for forensic analysis. Without this capture, security teams are left guessing, relying solely on CloudTrail API calls that may not reflect the internal logic or results of the executed script.
The absence of logging for SSM Automation creates several tangible risks that can amplify the impact of both accidental and intentional events. First, auditors frequently require evidence that changes to critical infrastructure are traceable to a specific user, role, or automated process; without logs, demonstrating compliance with frameworks such as SOC 2, PCIโDSS, or HIPAA becomes challenging. Second, during a security incident, the mean time to respond (MTTR) increases dramatically because investigators cannot determine whether a Runbook was the source of an unauthorized modification, nor can they ascertain the exact parameters that led to the change. Third, insider threat scenarios become harder to detect; a privileged user could craft a Runbook that exfiltrates data or alters security groups, and the lack of output logs removes a key visibility layer. In short, disabling this setting transforms Automation from a controllable, auditable tool into a black box that undermines trust in automated operations.
Interestingly, the SSM.6 control evaluates the setting at the accountโregion level and defaults to disabled, meaning that even accounts that have never invoked a single Automation run will fail the check as soon as Security Hub is enabled in that region. This design ensures that organizations cannot rely on “nonโusage” as a justification for skipping the control; instead, it prompts a proactive baseline configuration that applies uniformly across all workloads. For enterprises operating in multiple regions, the failure appears as a separate finding per region, which can quickly accumulate into a large number of duplicated tickets if not addressed systematically. Recognizing that the setting is regional encourages teams to treat logging as part of their standard accountโcreation pipeline, embedding the configuration into terraform modules, CloudFormation stacks, or Service Catalog products so that every new account inherits the desired state from the outset.
When weighing the decision to enable CloudWatch Logs for SSM Automation, it is useful to distinguish between production and nonโproduction environments, though the guidance leans toward uniformity. In production, the audit and troubleshooting benefits are unequivocal: any unplanned change triggered by a Runbook can be traced back to its script output, enabling rapid rootโcause analysis and reducing downtime. In development or staging accounts, the primary concern often shifts to cost, as CloudWatch Logs ingestion and storage can accumulate charges, especially if Runbooks generate verbose output. However, maintaining parity between environments is a proven strategy to prevent configuration drift; if logging is enabled only in production, a Runbook that works in staging might fail in production due to missing permissions or unexpected behavior, and the lack of logs in staging would hide the issue until it reaches production. Consequently, many organizations adopt a riskโbased approach: enable logging in all accounts but adjust retention policies and logโgroup sizes to keep costs manageable while preserving the essential audit trail.
Remediation via the AWS Management Console is straightforward and can be completed in a few minutes. Begin by opening the Systems Manager service, selecting the “Automation” section from the leftโhand navigation, and then clicking the “Settings” tab at the top of the page. Here you will find a toggle labeled “Output to CloudWatch Logs”โensure it is switched to the “Enabled” position. Immediately below, a dropโdown menu allows you to either select an existing CloudWatch Logs group or create a new one; adopting a naming convention such as /aws/ssm/automation/
For teams that prefer infrastructureโasโcode or need to apply the change across hundreds of accounts, the AWS CLI and CloudFormation provide scalable alternatives. The CLI command to enable logging in a specific region is:
“`
aws ssm update-automation-settings \
–output-cloudwatch-log-group-name /aws/ssm/automation/$(aws sts get-caller-identity –query Account –output text)-$(aws configure get region) \
–output-cloudwatch-log-enabled true
“`
This command first retrieves the current account ID and region to construct a meaningful log group name, then flips the setting to true. In a CloudFormation template, the analogous resource is an AWS::SSM::AutomationSettings resource with the properties OutputCloudWatchLogEnabled set to true and OutputCloudWatchLogGroupName referencing a log group defined elsewhere in the template. When deploying via StackSets or Control Tower, the same template can be targeted to all target organizational units, ensuring homogeneous compliance. Remember that the execution role for the Automation service (or the assumed role used by the Runbook) must retain the necessary CloudWatch Logs permissions, which we will detail in the next section.
Enabling the setting is only half of the equation; the Automation serviceโor more precisely, the IAM role that assumes the Runbookโmust be authorized to write logs to the designated CloudWatch Logs group. The minimal set of permissions required includes logs:CreateLogStream, logs:PutLogEvents, and logs:DescribeLogGroups (the latter is optional but helpful for troubleshooting). If you are using the default serviceโlinked role for Systems Manager (AWSServiceRoleForAmazonSSM), you can attach an inline policy that grants these actions on the specific log group ARN. For custom Runbook executions that rely on a crossโaccount AssumeRole scenario, ensure that the role being assumed includes the same logging permissions. A common pitfall is to enable the setting while forgetting to update the IAM policy, which results in the console showing the setting as “Enabled” but no logs actually appearing; Security Hub will still report the control as PASSED because it evaluates only the configuration flag, not the actual data flow. Therefore, after adjusting permissions, always validate with a test execution to confirm that logs are being written.
Verification is a critical step that transforms a configuration change into a reliable security control. After enabling logging and confirming that the IAM role has the appropriate permissions, execute a simple Runbook that contains an aws:executeScript action printing a known string, such as a timestamp or a custom message. For example, a Runbook with the following script content:
“`python
import datetime, json
print(json.dumps({“timestamp”: datetime.datetime.utcnow().isoformat(), “message”: “test log”}))
“`
When the Runbook completes, navigate to the CloudWatch Logs console, select the log group you specified, and look for the most recent log stream. Inside the stream, you should see the JSON output printed by the script. If the logs are present, the endโtoโend pipeline is functioning correctly. If they are missing, doubleโcheck the IAM permissions, verify that the log group exists in the same region as the Automation execution, and ensure there are no explicit deny policies blocking logs:PutLogEvents. Performing this validation not only satisfies auditors but also builds confidence that future automated changes will be observable.
Beyond basic verification, organizations should consider establishing proactive monitoring and alerting on the Automation logs to turn passive storage into an active security signal. CloudWatch Metrics Filters can be created to search for keywords such as “error,” “exception,” “failed,” or “traceback” within the log streams; each matching event can increment a custom metric that feeds into a CloudWatch Alarm. When the alarm breaches a threshold, an SNS notification can trigger a Slack message, a ticket in a ITSM system, or invoke a Lambda function that initiates a preliminary investigation. For longerโterm retention and advanced search capabilities, consider exporting the log group to an Amazon S3 bucket via a subscription filter, or forwarding logs to Amazon OpenSearch Service for interactive dashboards. Integrating these signals with Security Hubโeither through custom actions or by forwarding findings to a SIEMโensures that Automationโrelated anomalies are visible alongside other security events, providing a unified view of risk.
Effective log management extends beyond simply turning the switch on; it encompasses retention, encryption, and costโallocation strategies that align with organizational policies. Enable serverโside encryption using an AWS KMS key to protect log data at rest, especially if the logs contain sensitive information such as internal identifiers or partial payloads. Define a retention period that balances compliance requirements with expenseโfor instance, 30 days for operational troubleshooting and archiving to S3 Glacier Deep Adaptor for longerโterm audit needs. Tag the log group with keys such as “Environment,” “Owner,” and “CostCenter” to enable accurate chargeback and to facilitate automated cleanup scripts. Periodically review the volume of logs generated; if certain Runbooks produce excessive output, consider adjusting the script verbosity or implementing logโlevel filtering within the script itself to keep ingestion costs predictable while still preserving essential diagnostic information.
To conclude, addressing the SSM.6 finding is not merely a checkbox exercise; it is an opportunity to strengthen the observability and accountability of your automated workflows. Begin by generating a list of all regions where Security Hub reports the control as FAILED, then decide whether to remediate via the console, CLI, or IaC based on your operational model. Ensure that the IAM role used for Automation executions has the precise CloudWatch Logs permissions, and validate the pipeline with a test Runbook that writes identifiable output. Establish metric filters and alarms to convert log data into actionable alerts, and apply encryption, retention, and tagging policies that satisfy both security and finance teams. Finally, incorporate a quarterly review of the Automation settings into your governance checklist, so that any drift is caught early and the organization can maintain a high confidence score in Security Hub while benefiting from the speed and consistency that automation delivers.