Skip to content

Latest commit

 

History

History
410 lines (263 loc) · 21.9 KB

Features.md

File metadata and controls

410 lines (263 loc) · 21.9 KB

Little Orange

Little Orange Features

This document describes the features implemented in the Little Orange project. Features are grouped into functional categories.

Perform a project search for the feature name to find where and how it is implemented.

1 Orchestration and Deployment

1.0 Project Orchestration with Make

Useful entrypoints for project functions are documented as make targets. Utility functions are provided to aid project discoverability.

> make

+------------------------------------+
|        LITTLE ORANGE HELP          |
+------------------------------------+

Available targets:

Deploy                        Deploy Little Orange
DeployGitHubCredentials       Deploy stack to store GitHub credentials in Secrets Manager and create CodeBuild credentials
DeployPipeline                Deploy CodeBuild projects with webhook to run tests on GitHub pull requests and deploy on merge
...

See also the Tooling section of the main README.

1.1 Sceptre for CloudFormation Orchestration

CloudReach Sceptre is used to provision all Little Orange resources through multi-stack CloudFormation deployments. Stack inputs are wired to outputs of other stacks which Sceptre can interpret and resolve as dependencies at deploy time to ensure all connected resources are kept in-sync. Sceptre also provides extensible "hooks" and "resolvers" written in Python to accommodate additional functionality.

The Sceptre config is separated into multiple Stack Groups (Core, Security, Networking, etc.) that correspond to the core AWS Accounts created as part of Little Orange. The Stack Group Config (config.yaml) within each specifies the AWS Profile that will be used to access each role.

See also the Tooling section of the main README.

1.1.2 Sceptre Resolver Library

The Sceptre Resolver Library provides useful Sceptre Resolvers leveraged in Little Orange.

  • Command: allows for arbitrary shell commands to be evaluated as part of parameters for stack deployments
  • UploadS3: allows for assets to be uploaded to S3 and parameter resolved to S3 URI as part of stack deployments

1.1.3 AWS SAM Build Integration Library

The Sceptre Integration for AWS SAM provides a Python library for invoking AWS SAM project builds via make targets and reads in the resuling CloudFormation template.

The build integration library is invoked from an accompanying Python BuildSAM.py script to be invoked from the template_path of a Sceptre Stack Config. It implements a handler that invokes the integration library and returns the resulting template to be used in stack deployment.

1.2 Linting of YAML and CloudFormation

Linting of YAML files is performed by yamllint and driven by make.

Linting of CloudFormation is performed by cfn-lint and driven bt make.

These tools help to ensure the correctness and robustness of the resources maintained within this project.

1.3 Python Unit Testing

Python unit tests are implemented using pytest.

For code that interact with the AWS SDK for Python, the following strategies are employed in order of preference:

See also the Tooling section of the main README.

1.4 AWS SDK Profiles Generation

Little Orange includes a Python script to provide a programmatic way to generate AWS Profile entries for each account in the AWS Organization.

These AWS Profiles are named as required to drive the Sceptre deployment of Little Orange. A make target documents how to execute the script. This script also supports generating the AWS Profile entries required to deploy within the CodeBuild deployment automation.

# set an existing AWS Profile or provide credentials in environment to list accounts in the AWS Organization

# generate AWS Profiles and direct output to a file (to update profiles direct to ~/.aws/config)
make GenerateAWSProfiles >> ~/.aws/config.new

# generate AWS Profiles for use in ECS (executed by deployment automation)
make GenerateECSAWSProfiles >> ~/.aws/config.new

1.5 Deployment Automation from GitHub using CodeBuild (DevOps)

Little Orange deploys an integration between the GitHub repository and AWS CodeBuild to trigger deployment automation on new changes. CloudFormation (managed outside of the Sceptre deployment footprint) deploys the requisite infrastructure and configures credentials to access GitHub (credentials provided by user).

1.5.1 Pull Request Validation using CodeBuild

Little Orange configures webhooks to trigger a build project for changes to Pull Requests (PRs) in the GitHub repository. This build project executes linting and validation checks to provide early feedback.

1.6 Dependency Management using Pipenv

Python dependencies are managed by Pipenv. This provides a simple way to track project dependencies and boostrap new copies of the project. Required Pipenv commands are maintained and documented as make targets.

See also the Tooling section of the main README.

2 Centralised AWS Management

Little Orange configures tools and services with a "core" management account that support the operation and maintenance of the AWS multi-account footprint.

2.1 Account Management with AWS Organizations

Little Orange manages multiple accounts via AWS Organizations. Little Orange manages resources across a number of specialised accounts:

  • LittleOrangeManagement
  • LittleOrangeSecurity
  • LittleOrangeNetworking

2.1.1 CloudFormation Resource Providers for AWS Organizations

CloudFormation Resource Providers provide the ability to manage AWS Organizations resources. This allows for the structure of the AWS Organization to be defined declaratively using CloudFormation.

Organizations.cfn.yaml

2.1.2 Quarantine Organizational Unit (OU)

The Quarantine OU allows for a compromised AWS Account to be detained and all access to AWS APIs revoked. The Quarantine OU has a Service Control Policy (SCP) attached that assigns Deny to all AWS IAM Actions.

2.2 Resource Management with CloudFormation

Little Orange provisions and manages all resources via the AWS CloudFormation service. Resources and services not natively supported by CloudFormation are implemented using CloudFormation Custom Resources or CloudFormation Resource Providers.

2.2.1 CloudFormation Custom Resource Proxy

The CloudFormation Custom Resource Proxy allows for a single Custom Resource Lambda Function deployment to be leveraged from multiple accounts and regions. For Custom Resources implemented as AWS SAM projects this pattern is necessary as limitations exist for deploying the same AWS SAM template across many accounts or regions. The proxy is implemented as a lightweight, inlined Lambda Function that can be deployed across all accounts and regions -- Lambda-backed Custom Resources can only be invoked in the same account and region as the source CloudFormation Stack.

References:

GuardDuty via CloudFormation Custom Resource Proxy

  • The CloudFormation Stack defines a Custom Resource using the Custom Resource Proxy deployed within the same account and region.
  • The Custom Resource Proxy unwraps the actual target Custom Resource service token and parameters from the Properties payload.
  • The Custom Resource Proxy is configured with the appropriate IAM Role to perform a cross-region, cross-account invoke of the Custom Resource Lambda Function.
  • The crhelper library of the target Custom Resource handles completing the callback to CloudFormation for the resource.

2.2.2 CloudFormation Macro Proxy

The CloudFormation Macro Proxy allows for a single CloudFormation Lambda Macro Function deployment to be leveraged by multiple regions. Usually, a CloudFormation Macro must invoke a Lambda function in the same region.

When using the CloudFormation Macro Proxy, the Macro function itself is deployed once in a central location (reference), and the Lambda ARN is stored in AWS SSM Parameter Store. The CloudFormation Macro Proxy is deployed via Stack Set across all accounts and regions (reference).

Defining a proxied Macro involves specifying the local proxy as the function to invoke. The CloudFormation Macro Proxy handles looking up the macro name (e.g. NetworkingVPC below) to determine the actual Lambda ARN that backs the Macro and handles performing a cross-account and cross-region invocation of the function and returning the result (reference).

Macro:
  Type: AWS::CloudFormation::Macro
  Properties:
    Name: NetworkingVPC
    Description: Expands LittleOrange::Networking::VPC Resources into CloudFormation VPC Resources
    FunctionName: !Sub arn:aws:lambda:${AWS::Region}:${MacroProxyAccountId}:function:LittleOrangeCloudFormationMacroProxy
    ...

2.2.3 CloudFormation Self-Managed Roles using CloudFormation Stack Sets

CloudFormation Stack Sets can be deployed using self-managed IAM Roles in target accounts that does not rely on the AWS Organizations integration for CloudFormation. Little Orange handles deploying this required trust relationship between the management and child accounts via a service-managed Stack Set as per the following AWS Documentation:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html

2.3 Cost Management

2.3.1 CloudFormation Custom Resource for Cost and Usage Report Definitions

Management of Cost and Usage Reports resources are not supported by CloudFormation. Little Orange provides an implementation of a CloudFormation Custom Resource for administering Cost and Usage Reports.

2.3.2 Billing Reporting

Little Orange configures Cost and Usage Reports generation into S3. AWS Budgets is configured to provide a basic forecasted and actual spending alert.

2.3.2 Querying of Cost and Usage Reports with Amazon Athena

TBC

2.3.3 Cost Explorer Anomaly Detection

Little Orange configures AWS Cost Explorer to notify on daily and weekly anomaly detection.

AWS: Detecting unusual spend with AWS Cost Anomaly Detection

3 Logging and Audit

3.1 AWS CloudTrail

AWS CloudTrail is configured across all accounts and regions via an AWS Organizations-integrated trail.

AWS: Creating a trail for an organization

3.1.1 CloudFormation Custom Resource for Organizations CloudTrail Support

CloudFormation support for AWS CloudTrail does not yet provide support for configuring AWS Organizations integration for a trail. Little Orange provides a CloudFormation Custom Resource for enabling AWS Organizations integration on an existing trail.

3.2 AWS Config

3.2.1 Delegated Administrator for Config

4 Identity and Access Management

4.1 Federated Identity with AWS SSO

4.2 Federated Identity with IAM SAML Identity Provider

4.2.1 CloudFormation Custom Resource for IAM SAML Identity Provider

5 Security

5.1 GuardDuty enabled across Organization

5.1.2 Delegated Administrator for GuardDuty

5.1.3 CloudFormation Custom Resource for GuardDuty Organizations Support

5.2 Security Hub enabled across Organization

5.2.1 CloudFormation Custom Resource for Security Hub Delegated Administrator

6 Networking

6.1 VPC Factory CloudFormation Macro

6.1.1 VPC Factory deployment via Service Catalog

6.1.2 VPC Factory integration with Transit Gateway

TBC

6.1.3 VPC Factory integration with Centralised DNS

TBC

6.1.4 VPC Factory integration with Centralised VPC Endpoints

TBC

6.2 Transit Gateway for VPC Connectivity

6.2.1 Automated Transit Gateway VPC attachment management

6.3 Centralised DNS with Route53 Resolvers

6.3.1 CloudFormation Custom Resource for Route53 Resolver Endpoint Extended Output

6.4 Centralised VPC Endpoints

6.5 Managed CIDR Ranges with Prefix Lists

6.6 Amazon Client VPN

TBC

Add notes about setting up ACM Certificate

7 Workload Services

TBC

AWS SAM Support

AWS Billing

  • Cost and Usage Reports
  • AWS Budget: forecasted and actual
  • Cost Explorer Anomaly Detection: daily and weekly

AWS CloudTrail

  • CloudTrail trail deployed to Core account
  • CloudTrail data delivered to S3 Bucket in Core account
  • CloudTrail data delivered to CloudWatch Log Group in Core account
  • Trail enabled as Organization trail via SAM Custom Resource

AWS Config

  • AWS Organisation Trusted Access enabled for Config and Config Rules
  • Security account enabled as Delegated Administrator for Config Rules and Config
  • Config deployed across Organization via Stack Set deployed to Core account (and Stack Set for Core account directly)
  • Config Aggregator and S3 Bucket for Config snapshots deployed to Security account

Config Architecture

AWS Organizations

  • Declarative Organizations resource state in CloudFormation stack in Core account
  • Organizations resource management via CloudFormation Resource Providers
    • AWS::Organization::Organization
    • AWS::Organization::OrganizationalUnit
    • AWS::Organization::Account
    • AWS::Organization::ServiceControlPolicy

AWS GuardDuty

  • Security account enabled as Delegated Administrator of Organization for GuardDuty
  • GuardDuty Organization configuration via SAM Custom Resource in Core account
  • GuardDuty enabled in all regions of Security account and auto-enable enabled via Stack Set in Core account
  • Little Orange accounts specifically enrolled as GuardDuty member accounts via Stack Set in Security account

GuardDuty via Custom Resources

AWS SecurityHub

  • SecurityHub Hub deployed across Organization accounts and regions via Stack Set in Core account
  • Custom Resource registers Security account as Delegated Administrator for Security Hub and handles registering existing accounts as members

SecurityHub Architecture

Federated Identify with AWS SSO

The below architecture is not implemented as part of Little Orange due to gaps in ability to automate configuration of AWS SSO. Currently, AWS SSO can only be configured via the AWS Console. The following guide presents a good ClickOps walk-through of configurating AWS SSO for federated identity with Azure Active Directory:

https://aws.amazon.com/blogs/aws/the-next-evolution-in-aws-single-sign-on/

AWS SSO Federated Identity with Azure AD

Federated Identity with IAM SAML Identity Provider

Federated Identity with Azure AD

VPC Factory with CloudFormation Macro

VPC Factory with CloudFormation Macro

VPC Architecture

Service Catalog for VPC Deployment

Service Catalog for VPC Deployment

Centralised DNS with Route 53 Resolver

Centralised DNS with Route 53 Resolver

Resolving DNS between VPCs with Route 53 Resolver

Transit Gateway

Automated management of Transit Gateway VPC Attachments

Centralised VPC Endpoints