Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

Commit 2ac702d

Browse files
committed
Cross account deployments intro
1 parent 3b412b5 commit 2ac702d

File tree

7 files changed

+46
-1
lines changed

7 files changed

+46
-1
lines changed

workshop/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pygmentsCodeFences = true
1414
pygmentsStyle = "monokai"
1515

1616
[params]
17-
editURL = "https://github.com/aws-samples/serverless-workshops"
17+
editURL = "https://github.com/aws-samples/aws-serverless-cicd-workshop/tree/master/workshop/content/"
1818
description = "Building a CI/CD pipeline for Serverless applications"
1919
author = "Fernando Dingler <fdingler@amazon.com>"
2020
disableBreadcrumb = false
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
+++
2+
title = "Cross Account Deployments"
3+
date = 2019-10-02T16:10:44-07:00
4+
weight = 40
5+
chapter = true
6+
pre = "<b>6. </b>"
7+
+++
8+
# Cross Account Deployments
9+
10+
Cross-account deployments are useful for customers who separate their environments (Dev, Test, Prod) into different AWS accounts. In this chapter you will learn how to deploy across multiple accounts using AWS Code Pipeline.
11+
12+
![DevWorkflow](/images/cross-account-chapter.png)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
+++
2+
title = "How does it work"
3+
date = 2019-11-11T14:46:02-08:00
4+
weight = 20
5+
+++
6+
7+
Before jumping to the implementation, we need to understand the different pieces that allow Code Pipeline to deploy across a different account. The following diagram shows a zoomed-in view of the services and roles involved in this process.
8+
9+
![CrossAccountDeploy](/images/cross-account-deploy.png)
10+
11+
#### Explanation
12+
13+
The diagram above illustrates what happens when CodePipeline begins a deployment to the Production account. The first step is to assume the **IAM Pipeline Role** that exists in the Production account; This is possible because the role has a Trust Policy that allows the Development account to assume it. The second step is CodePipeline uses that role to trigger a deployment in CloudFormation by passing the **IAM Deployer Role**. This action is called [PassRole](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html) and is needed for CloudFormation to create resources on your behalf. Finally, as you learned in previous chapters, CloudFormation gets the deployment artifacts from S3 and decrypts them by using the KMS Customer Managed Key.
14+
15+
#### Why encrypt the artifacts?
16+
17+
AWS CodePipeline *always* stores artifacts on S3 with encryption enabled and there is no way to disable it. The default behavior is to use the AWS Managed Key to encrypt them, but this approach doesn't work for granting access to S3 buckets across accounts. Therefore you must create a KMS Customer Managed Key and then give the IAM role in the Production account permissions to use it to decrypt the artifacts.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
+++
2+
title = "Introduction"
3+
date = 2019-11-11T14:46:02-08:00
4+
weight = 15
5+
+++
6+
7+
### Environment separation
8+
9+
Separating environments (Dev, Test, Prod) into different AWS accounts is a very common practice among AWS customers. And the main motivation being the ability to give developers full administrative access to the Dev environment, so that they can innovate and iterate quickly, but give them _limited_ access to higher environments, like Production. There are other motivations as well, like managing [AWS Service Quotas](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html) separately and having billing details broken down per environment.
10+
11+
The following diagram illustrates a simple account setup that many customers start with. And we will also be using it throughout this chapter. But the concepts that you will learn here can be applied to any form of multi-account setup.
12+
13+
![EnvironmentSeparation](/images/environment-separation.png)
14+
15+
As you can tell from the diagram, the Dev account hosts the Code Pipeline, Artifacts Bucket and the Code Repository. The CodePipeline then deploys across the Production account using an [assumed role](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html).
16+
20.8 KB
Loading
49.9 KB
Loading
44.5 KB
Loading

0 commit comments

Comments
 (0)