Friday, 17 November 2023

Streamlining Cloud Governance with AWS Control Tower

Özgür Bagci

Engineer

One of the primary challenges that enterprise IT teams encounter when utilizing Amazon Web Services (AWS) is the ability to provision AWS accounts for various teams with distinct needs while maintaining best practices and security compliance. This process often involves the use of internal pipelines and procedures, such as AWS Organization and AWS IAM Identity Center, and may require manual approvals and the implementation of a ticketing system. The process of account provisioning can be time-consuming and may result in decreased productivity for requesting teams, who may have to wait for their accounts to be ready. To address this common challenge faced by businesses using AWS, the cloud provider offers a service called AWS Control Tower. This service streamlines the process of creating and managing AWS accounts according to best practices and guidelines. AWS Control Tower utilizes AWS Service Catalog and offers blueprint capabilities to create landing zones for teams, and also manages logging and auditing accounts. In this article, we will delve into the benefits of using AWS Control Tower and provide a proof of concept (PoC) process for managing account creation requests through Git pull requests (PRs) using a Terraform module developed by AWS.

Managing Security Compliance with AWS Control Tower Guardrails

One of the key benefits of using AWS Control Tower is the ability to easily manage security compliance through the use of guardrails, also known as controls. These guardrails utilize various AWS services, such as AWS CloudFormation, AWS Organizations Service Control Policies (SCPs), and AWS Config, to function. With AWS Control Tower, you can implement three types of guardrail behavior: preventative, detective, and proactive. On a centralized dashboard, you can also view reports detailing the security compliance status of the AWS accounts within your organization.

Preventative guardrails allow you to enforce certain limitations on the AWS accounts within your organization by utilizing AWS Organizations SCPs. For example, you can use preventative controls to streamline compliance with the General Data Protection Regulation (GDPR) through constraints on data residency. Detective guardrails, on the other hand, can be used to create controls for detecting certain activities, such as whether RDS snapshots are enabled. These guardrails utilize AWS Config to function. Proactive guardrails allow you to enforce constraints on resources and prevent them from being provisioned if they are not in compliance with your constraints. For instance, you can use proactive guardrails to disallow the creation of wildcard TLS certificates.

In addition to the three types of guardrail behavior, there are also three categories of guardrail guidance: mandatory, strongly recommended, and elective. Mandatory guardrails are always enabled for your Organizational Unit (OU) and cannot be disabled for any OUs. Strongly recommended guardrails can be disabled at the OU level, while elective controls are disabled by default and can be enabled at the OU level.

It is important to note that these guardrails are provided by AWS and cannot be customized. However, they are based on well-architected best practices and AWS is working to expand the available options based on evolving needs. If you require custom controls that are not supported by AWS Control Tower guardrails, you may need to utilize tools such as SCPs or AWS Config. While custom guardrails are not currently supported, the extensive number of available guardrails can significantly reduce the workload of IT departments in terms of security compliance.

AWS Control Tower Accounts: Logging and Auditing

When AWS Control Tower is provisioned, it creates two accounts - one for logging and the other for auditing purposes. These accounts are set up in accordance with best practices for access rights and protections.

The logging account, also known as the Log archive account, is responsible for storing a copy of all AWS CloudTrail and AWS Config log files in an S3 bucket. These logs are aggregated from all the landing zones within your organization and can be used for automated audits. Additionally, this account can host custom AWS Config rules and is configured to make the logs immutable, providing an additional layer of security.

The auditing account is also set up by AWS Control Tower, providing read-only access for auditors and full access for administrators across all landing zones. It is important to note that access to this account should be restricted to security and compliance teams only. This account also receives configuration events and other security notifications through AWS SNS, enabling the topics to be subscribed for various security-related workloads for automation and alerting.

Standardizing Landing Zones with AWS Service Catalog and Account Factory

Enterprise cloud clients may require various types of resources on their landing zones, depending on the workloads they have. However, these landing zones should still adhere to a customary standard, and it should be noted that provisioning common resources can take a significant amount of time. With AWS Service Catalog, you can create blueprints for landing zones. For example, you can create different blueprints for landing zones that require FaaS-based resources and those that require Kubernetes-based resources, or you might create blueprints for landing zones that need a spoke network for connecting to on-premises services.

AWS Account Factory makes it easy to provision new landing zones on AWS Organizations and can utilize AWS Service Catalogs to provision the accounts with blueprints. This improves the standardization of accounts and increases the development speed for teams, as common resources are already provisioned with the account. It also simplifies the process of following various requirements without the need for complicated procedures.

Creating the Control Tower

Next, we will set up a proof of concept configuration together. To do this, we will need a root AWS account to use to provision the AWS Control Tower. The Control Tower will then provision AWS Organizations, IAM Identity Center, and AWS Service Catalog for you and manage them. This will allow you to have single sign-on across your accounts, manage users through the IAM Identity Center across multiple accounts, and create AWS accounts with custom configurations.

Control Tower Creation 2.png

It is best to follow the tutorial in the AWS documentation to create the Control Tower, as configuration details may change over time. For our proof of concept, we will need to configure base Organizational Units (OUs) and AWS accounts. We will create two OUs under the root: the Security OU and the Sandbox OU. The Security OU includes accounts for logging and auditing and is created using AWS best practices configuration. The resource and audit log retention durations can also be adjusted to meet your specific requirements.

Setting up the AWS Control Tower Account Factory for Terraform (AFT)

AWS Control Tower Account Factory.png

The AWS Control Tower Account Factory for Terraform (AFT) can be used to streamline the account creation process using GitOps. Here is a summary of the steps involved in setting up AFT:

  1. Manually create a new Organizational Unit (OU) and AWS account under the new OU using the Account Factory of the Control Tower. This account and OU will be used by AFT to provision the required resources for its operation.
  2. Use the base repository to provision resources into the AFT AWS account. Adjust the variables in the terraform.tfvars file as needed. While this repository does not have a pipeline, it is a standard Terraform codebase and it is straightforward to create a pipeline for it. In this case, we applied the code from our local machine as it was just a proof of concept.
  3. Clone the four other required repositories into your account. These repositories will be used to make customizations and provision new accounts. Note that these repositories may be stored privately, as AFT uses AWS CodePipeline to authorize itself to read them.

Connect to GitHub.png

  1. After the resources are provisioned, authorize the CodePipeline to read the repositories for customizations and account requests. The process for doing this may vary depending on the provider, so it is best to follow the documentation and prompts provided by your provider.
  2. After authorization, run the pipelines in the CodePipeline again, as they will be in a failed state due to the lack of authorization when they were initially run.

Note: It is always a good idea to refer to the AFT documentation for the most up-to-date information, as the process may change over time.

Using GitOps to Request New AWS Accounts with the Control Tower and AFT

Now that we have set up the Control Tower and AFT, we can use them to request new AWS accounts using GitOps. We will use the repository cloned from https://github.com/hashicorp/learn-terraform-aft-account-request to request an AWS account.

To understand how this works, let's assume that we have an IT team that is responsible for managing this repository. Direct commits to the main branch are not allowed, and only members of the DevOps Engineers group can create pull requests (PRs) to the repository. The IT team is responsible for reviewing and approving PRs, and at least two approvals are required before a PR can be merged. This process helps ensure compliance and can be further customized to meet specific requirements.

To request a new AWS account, we create a new file in the repository with the name of our project and insert the code for the account creation module. We adjust the code as needed and name the file appropriately for our new account. Typically, we want the root user of the AWS account to be an email managed by the IT team, and the SSO user to be the DevOps engineer who will be responsible for managing the account with administrator permissions.

Pipeline.png

We then create a PR and wait for the IT team to review and merge it. After the PR is merged, the CodePipeline will pick up the changes and provision a new account. This GitOps approach allows us to track the history of the account creation process, including who created the PR, who approved it, and who merged it. It also helps ensure compliance on the audit side of account creation.

Customizing AWS Account Provisioning with AFT and GitOps

The use of the AWS Control Tower Account Factory for Terraform (AFT) in conjunction with a GitOps approach can provide numerous benefits when requesting and creating new AWS accounts. This approach streamlines the process, provides a traceable history, and allows for customizable configurations.

With AFT, clients have the ability to tailor their account configurations at both the global and individual level. This enables them to meet their specific requirements and constraints. For instance, clients may wish to globally restrict the provisioning of resources to a particular region, or they may choose to individually whitelist regions for each account using tags. This can be particularly useful in enterprise scenarios where multiple regions are used for different workloads and strict isolation is required due to data protection laws.

In addition to these customization options, AFT also enables clients to provision default resources. For example, clients may choose to automatically create an EKS cluster for every new account. AFT also allows for the customization of the account provisioning process itself.

Consider AWS Control Tower for your AWS Environment

AWS Control Tower is a fully managed service that makes it easy for organizations to set up, govern, and manage multi-account AWS environments. With its guardrails and centralized dashboard, you can enforce security and compliance policies, automate account setup, and streamline management tasks. Whether you're a startup or an enterprise, AWS Control Tower provides a simplified and secure way to manage your AWS environment, helping you increase efficiency, reduce operational costs, and stay ahead of the ever-evolving security landscape.

As an AWS partner, Nexode Consulting can help you design, deploy, and manage your AWS Control Tower environment. With experience working with organizations of all sizes, our consultants have the expertise to help you get the most out of AWS Control Tower and other AWS services. Whether you need guidance with implementation, optimization, or ongoing management, Nexode Consulting is here to help. Contact us today to learn how we can help you achieve your cloud goals.

Share this article!

NEXODE CONSULTING GmbH

OBERWALLSTRAßE 6

10117 BERLIN