Cloudformation templates for AWS Integration with P0 Security
Summary: We will be using a cloudformation template to deploy a stackset in order to create an IAM Role for P0 across all children accounts for an organization. Individual stacks will be deployed to a single region across all the children accounts.
In order to cover the management account, we will then be deploying a stack manually via the same stackset to target the management account and create the same IAM Role for P0.
Instructions: Please copy the current directory to your local instance and execute the following using the AWS Console
- AWS -> Management Account -> Cloudformation -> StackSets
- Create StackSet
- Service-managed permissions
- Upload the
iam_management.json
template - Provide a StackSet name like
P0IAMRoleStackSet
- Enter Google Audience ID for P0
- Deploy New stacks
- Deploy to organization (This will ONLY deploy to children accounts)
- Pick a single active region aka
us-west-2
- Submit
- AWS -> Management Account -> Cloudformation -> Stack
- Create stack with new resources
- Choose an existing template
- Upload the
iam_management.json
template - Provide a Stack name like
P0IAMRoleStack
- Enter the Google Audience ID for P0
- Submit
- AWS -> Cloudformation -> StackSets
- Create a new stackset using the 'iam_resource_lister.yaml` template
- Use service-managed permissions
- Upload the
iam_resource_lister.yaml
template - Provide a StackSet name like
P0IAMRoleListerStackSet
- Enter Google Audience ID for P0
- Enter TargetAccountID as the parent Account ID (the value doesn't really matter, it'll be overridden)
- Deploy new stacks
- Deploy to organization
- Specify a single region (us-west-2), its not relevant as the IAM role will be global
- Submit
- AWS -> Cloudformation -> Stack
- Create a new stack using existing resources
- Choose an existing template
- Upload the
iam_resource_lister.yaml
template - Provide a Stack name like
P0IAMRoleListerStack
- Enter Google Audience ID for P0
- Enter TargetAccountID as the parent Account ID
- Submit
- AWS -> Cloudformation -> StackSets
- Create a new stackset
- Use service-managed permissions
- Upload the
resource_explorer_local_index.yaml
template - Provide a StackSet name like
LocalIndexStackSetForChildAccounts
- Deploy new stacks
- Deploy to organization
- Specify all active regions except one (which will be used for the aggregator index, we can use
us-west-2
as the exception) - Submit
- We'll be creating new IAM roles to use for self-managed permissions for the CF templates.
- AWS -> Cloudformation -> Stacks
- Create a new stack using existing resources
- Choose an existing template
- Upload the
stack_set_roles.yaml
template - Provide a Stack Name like
StackSetRoles
- Submit
- Now we'll create the local indexes in the management account
- AWS -> Cloudformation -> StackSets
- Create a new stack set
- Use self-service permissions
- Use IAM admin role created in step 3 -
AWSCloudFormationStackSetAdministrationRole
- Use IAM execution role created in step 3 -
AWSCloudFormationStackSetExecutionRole
- Upload same template from Step B.2 -
resource_explorer_local_index.yaml
- Provide a StackSet name like
LocalIndexStackSetForParentAccount
- Deploy stack sets in accounts: Put in the management account ID
- Specify all active regions except one (which will be used for the aggregator index, we can use
us-west-2
as the exception) - Submit
- AWS -> Cloudformation -> StackSets
- Create a new stackset
- Use service-managed permissions
- Upload the
resource_explorer_aggregator_index.yaml
template - Provide a StackSet name like
AggregatorIndexStackSetForChildAccounts
- Deploy new stacks
- Deploy to organization
- Specify the excluded active region from Step B.2.vi (e.g.
us-west-2
) - Submit
- We'll be using the same IAM roles as in Step C.3
- AWS -> Cloudformation -> StackSets
- Create a new stack set
- Use self-service permissions
- Use IAM admin role created in step C.3 -
AWSCloudFormationStackSetAdministrationRole
- Use IAM execution role created in step C.3 -
AWSCloudFormationStackSetExecutionRole
- Upload same template from Step D.2 -
resource_explorer_aggregator_index.yaml
- Provide a StackSet name like
AggregatorIndexStackSetForParentAccount
- Deploy stack sets in accounts: Put in the management account ID
- Specify the excluded active region from Step C.6.vii (e.g.
us-west-2
) - Submit
- AWS -> Cloudformation -> StackSets
- Create a new stackset
- Use service-managed permissions
- Upload the
resource_explorer_view.yaml
template - Provide a StackSet name like
ResourceExplorerViewStackSetForChildAccounts
- Set aggregator region to
us-west-2
- Deploy new stacks
- Deploy to organization
- Specify the same aggregator region as Step D.2.vi
- Submit
- AWS -> Cloudformation -> Stacks
- Create a new stack using existing resources
- Choose an existing template
- Upload the
resource_explorer_view.yaml
template - Provide a Stack name like
ResourceExplorerViewStack
- Specify the aggregator region as Step E.3.vii (
us-west-2
) - Enter TargetAccountID as the parent Account ID
- Submit