View a markdown version of this page

SEC01-BP05 Automate deployment of standard security controls - AWS Well-Architected Framework

SEC01-BP05 Automate deployment of standard security controls

Manually-applied security controls can drift, vary between environments, and are hard to audit. Define controls as code, version them, test them, and deploy them through a pipeline to keep them consistent, reviewable, and repeatable.

Desired outcome:

  • Your standard controls are defined as code and committed to a version control system.

  • Your CI/CD pipelines detect changes and automate testing and deployment across your environments.

  • Your guardrails catch template misconfigurations before deployment proceeds.

  • Your workload teams deploy approved configurations through a self-service mechanism.

  • You have secure backup and recovery for control definitions, scripts, and related data.

Common anti-patterns:

  • Teams change standard security controls manually through a console or command line.

  • A central team defines controls but relies on each workload team to implement them manually.

  • Workload teams wait on a central security team to deploy workload-level controls on request.

  • The same individuals develop, test, and deploy control automation with no separation of duties.

Benefits of establishing this best practice:

  • Version control makes every change to a control trackable and comparable over time.

  • Automated testing and deployment increase consistency and reduce repetitive manual work.

  • Self-service deployment of approved configurations lowers the risk of misconfiguration and misuse.

  • Teams incorporate security controls earlier in development, where issues cost less to fix.

Level of risk exposed if this best practice is not established: Medium

Implementation guidance

Once you separate workloads into multiple accounts, you may encounter a scaling problem. Each environment requires a consistent set of security controls, and applying them manually across many accounts guarantees inconsistency. Many controls are standard across the organization, such as integrating a central identity provider, defining networks and firewalls, and configuring standard locations for storing and analyzing logs. Infrastructure as code (IaC) lets you define these standard controls declaratively and apply the same rigor to them that you apply to application code.

Declarative definitions provide three useful capabilities that do not exist when performing manual configuration. Storing templates in AWS CloudFormation under source control provides a reviewable history of every change. Automated testing with a tool such as AWS CloudFormation Guard validates a template against policy before it deploys. Drift detection tells you when a deployed control no longer matches its definition, which is often the first sign of an unauthorized or accidental change. Static application security testing (SAST) analyzes templates and code before deployment with tools such as cfn-lint, dynamic application security testing (DAST) probes running systems for runtime-only flaws, and software composition analysis (SCA) finds known vulnerabilities in third-party dependencies.

A pipeline built from services such as AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy automates deployment of these controls. The Deployments OU guidance recommends housing your CI/CD capabilities in their own deployment accounts, separated from the workload environments they deploy to, so that unauthorized access in one does not reach the controls that govern the rest. Consider how to separate duties in this architecture. For example, when the same person authors, tests, and deploys a control without an independent check, the pipeline provides no assurance.

With Service Catalog, a central security team publishes approved templates as products that workload teams incorporate into their own deployments, so approved configurations spread without a central bottleneck. AWS Control Tower supplies a set of templates and controls as a starting point, and its Account Factory lets workload teams create new accounts without waiting on a central approval step. Self-service removes the dependency on a central team while keeping definitions under central governance.

Some services provide declarative policies to control specific security configurations across all AWS accounts in an AWS Organization. After you attach the policy, the configuration persists as the service adds new features or APIs. For example, a declarative policy can be set to force enabling Block Public Access on all S3 buckets across the AWS Organization, without configuring it in each account.

Implementation steps

  1. Store control templates in version control: Decide how you will store and maintain your control templates in a version control system, so that every change is tracked and reviewable.

  2. Build CI/CD pipelines for your templates: Create pipelines that test and deploy your templates, with checks that catch misconfigurations and confirm templates meet your organization's standards.

  3. Integrate SAST and DAST: Add static analysis of code and IaC templates and dynamic testing of deployed environments into the pipeline, so vulnerabilities are caught before and after deployment.

  4. Scan third-party dependencies: Add software composition analysis to identify known vulnerabilities in external libraries and components your controls and workloads rely on.

  5. Publish a catalog of standardized templates: Build a catalog of approved templates that workload teams use to deploy accounts and services according to your requirements through self-service.

  6. Implement secure backup and recovery: Establish secure backup and recovery for your control configurations, scripts, and related data so you can restore them after loss or corruption. SEC08-BP03 Automate data at rest protection covers how to automate encrypted, recoverable backups.

  7. Use declarative policies when available: Declarative policies allow you to centrally manage and configure select security-related features on AWS services across all accounts in an AWS Organization, without the need to configure that feature for every account.

Resources

Related best practices:

Related documents:

Related videos:

Related examples:

Related tools: