Skip to content

Commit 8627be4

Browse files
danxie1999Dan Xie
authored and
Dan Xie
committed
feat: add support for AWS China region
1 parent 325ae13 commit 8627be4

29 files changed

+1372
-116
lines changed

docs/admin-guide.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ definitions in them as desired.
5959
## adfconfig
6060

6161
The `adfconfig.yml` file resides on the
62-
[management account](#management-account) CodeCommit Repository (in `us-east-1`)
62+
[management account](#management-account) CodeCommit Repository (in `us-east-1` or `cn-north-1`)
6363
and defines the general high-level configuration for the AWS Deployment
6464
Framework.
6565

@@ -964,7 +964,7 @@ To determine the current version, follow these steps:
964964
### ADF version you have deployed
965965

966966
To check the current version of ADF that you have deployed, go to the management
967-
account in us-east-1. Check the CloudFormation stack output or tag of the
967+
account in us-east-1 or cn-north-1. Check the CloudFormation stack output or tag of the
968968
`serverlessrepo-aws-deployment-framework` Stack.
969969

970970
- In the outputs tab, it will show the version as the `ADFVersionNumber`.
@@ -985,7 +985,7 @@ releases](https://github.com/awslabs/aws-deployment-framework/releases).
985985
The `serverlessrepo-aws-deployment-framework` stack is updated through this
986986
process with new changes that were included in that release of ADF.
987987

988-
To check the progress in the management account in `us-east-1`, follow these
988+
To check the progress in the management account in `us-east-1` or `cn-north-1`, follow these
989989
steps:
990990

991991
1. Go to the [CloudFormation
@@ -1028,7 +1028,7 @@ Which branch is used is determined by:
10281028

10291029
Alternatively, you can also perform the update using the AWS CLI.
10301030

1031-
In the management account in `us-east-1`:
1031+
In the management account in `us-east-1` or `cn-north-1`:
10321032

10331033
1. Go to the Pull Request section of the `aws-deployment-framework-bootstrap`
10341034
[CodeCommit
@@ -1043,7 +1043,7 @@ In the management account in `us-east-1`:
10431043
changes that it proposes. Once reviewed, merge the pull request to continue.
10441044

10451045
Confirm the `aws-deployment-framework-bootstrap` pipeline in the management
1046-
account in `us-east-1`:
1046+
account in `us-east-1` or `cn-north-1`:
10471047

10481048
1. Go to the [CodePipeline console for the aws-deployment-framework-bootstrap
10491049
pipeline](https://console.aws.amazon.com/codesuite/codepipeline/pipelines/aws-deployment-framework-bootstrap-pipeline/view?region=us-east-1).
@@ -1059,7 +1059,7 @@ creation and on-boarding process in parallel.
10591059
These are managed through Step Function state machines.
10601060

10611061
1. Navigate to the [AWS Step Functions service](https://us-east-1.console.aws.amazon.com/states/home?region=us-east-1#/statemachines)
1062-
in the management account in `us-east-1`.
1062+
in the management account in `us-east-1` or `cn-north-1`.
10631063
2. Check the `AccountManagementStateMachine...` state machine, all recent
10641064
invocations since we performed the update should succeed. It could be the
10651065
case that there are no invocations at all. In that case, wait a minute and
@@ -1138,10 +1138,11 @@ Alternatively, you can also perform the update using the AWS CLI.
11381138

11391139
If you wish to remove ADF you can delete the CloudFormation stack named
11401140
`serverlessrepo-aws-deployment-framework` in the management account in
1141-
the `us-east-1` region. This will remove most resources created by ADF
1142-
in the management account. With the exception of S3 buckets and SSM parameters.
1143-
If you bootstrapped ADF into the management account you need to manually remove
1144-
the bootstrap stacks as well.
1141+
the `us-east-1` region for global partition deployments; for China deployments
1142+
in `cn-north-1` region. This will remove most resources created by ADF in the management
1143+
account. With the exception of S3 buckets and SSM parameters. If you bootstrapped
1144+
ADF into the management account you need to manually remove the bootstrap stacks
1145+
as well.
11451146

11461147
Feel free to delete the S3 buckets, SSM parameters that start with the `/adf`
11471148
prefix, as well as other CloudFormation stacks such as:
@@ -1164,7 +1165,7 @@ the base stack when the account is moved to the Root of the AWS Organization.
11641165
One thing to keep in mind if you are planning to re-install ADF is that you
11651166
will want to clean up the parameter from SSM Parameter Store. You can safely
11661167
remove all `/adf` prefixed SSM parameters. But most importantly, you need to
1167-
remove the `/adf/deployment_account_id` in `us-east-1` on the
1168+
remove the `/adf/deployment_account_id` in `us-east-1` or `cn-north-1` on the
11681169
management account.
11691170
As AWS Step Functions uses this parameter to determine if ADF has already got a
11701171
deployment account setup. If you re-install ADF with this parameter set to a
@@ -1187,7 +1188,7 @@ There are two ways to enable this:
11871188
to deploy the latest version again, set the `Log Level` to `DEBUG` to get
11881189
extra logging information about the issue you are experiencing.
11891190
2. If you are running an older version of ADF, please navigate to the
1190-
CloudFormation Console in `us-east-1` of the AWS Management account.
1191+
CloudFormation Console in `us-east-1` or `cn-north-1` of the AWS Management account.
11911192
3. Update the stack.
11921193
4. For any ADF deployment of `v3.2.0` and later, please change the `Log Level`
11931194
parameter and set it to `DEBUG`. Deploy those changes and revert them after
@@ -1202,7 +1203,7 @@ Please trace the failed component and dive into/report the debug information.
12021203

12031204
The main components to look at are:
12041205

1205-
1. In the AWS Management Account in `us-east-1`:
1206+
1. In the AWS Management Account in `us-east-1` or `cn-north-1`:
12061207
2. The [CloudFormation aws-deployment-framework stack](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks?filteringStatus=active&filteringText=aws-deployment-framework&viewNested=true&hideStacks=false).
12071208
3. The [CloudWatch Logs for the Lambda functions deployed by ADF](https://console.aws.amazon.com/lambda/home?region=us-east-1#/functions?f0=true&n0=false&op=and&v0=ADF).
12081209
4. Check if the [CodeCommit pull
@@ -1211,7 +1212,7 @@ The main components to look at are:
12111212
branch for the `aws-deployment-framework-bootstrap` (ADF Bootstrap) repository.
12121213
5. The [CodePipeline execution of the AWS Bootstrap pipeline](https://console.aws.amazon.com/codesuite/codepipeline/pipelines/aws-deployment-framework-bootstrap-pipeline/view?region=us-east-1).
12131214
6. Navigate to the [AWS Step Functions service](https://us-east-1.console.aws.amazon.com/states/home?region=us-east-1#/statemachines)
1214-
in the management account in `us-east-1`. Check the state machines named
1215+
in the management account in `us-east-1` or `cn-north-1`. Check the state machines named
12151216
`AccountManagementStateMachine...` and
12161217
`AccountBootstrappingStateMachine...`. Look at recent executions only.
12171218
- When you find one that has a failed execution, check the components that

docs/installation-guide.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ It is okay to install ADF and AWS Control Tower in different regions.
2828
For example:
2929

3030
- Install AWS Control Tower in `eu-central-1`.
31-
- Install ADF in `us-east-1`.
31+
- Install ADF in `us-east-1` or `cn-north-1`.
3232

3333
**If you want to use ADF and AWS Control Tower, we recommend that you setup
3434
AWS Control Tower prior to installing ADF.**
@@ -43,12 +43,12 @@ Ensure you have setup [AWS CloudTrail](https://aws.amazon.com/cloudtrail/)
4343
*(Not the default trail)* in your Management Account that spans **all
4444
regions**, the trail itself can be created in any region. Events [triggered via
4545
CloudTrail](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_incident-response.html)
46-
for AWS Organizations can only be acted upon in the us-east-1 (North Virginia)
46+
for AWS Organizations can only be acted upon in the us-east-1 (North Virginia) or `cn-northwest-1`
4747
region.
4848

4949
Please use the [AWS CloudTrail
5050
instructions](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)
51-
to configure the CloudTrail in the `us-east-1` region within the AWS
51+
to configure the CloudTrail in the `us-east-1` or `cn-north-1` region within the AWS
5252
Organizations Management AWS Account.
5353

5454
### 1.2. Enable AWS Organizations API Access
@@ -92,7 +92,6 @@ Please note that building on *Windows* is not supported, please use the
9292
This should return a table that is possibly empty.
9393
- Additionally, running `docker --version` should return version 19 or
9494
later.
95-
<!-- markdown-link-check-disable-next-line -->
9695
- [make](https://www.gnu.org/software/make/)
9796
- To test if it is available, run `make --version`.
9897
This should return 4.3 or later.
@@ -102,7 +101,6 @@ Please note that building on *Windows* is not supported, please use the
102101
- [jq](https://github.com/jqlang/jq)
103102
- To test if it is available, run `jq --version`.
104103
This version should be 1.6 or later.
105-
<!-- markdown-link-check-disable-next-line -->
106104
- [sed](https://www.gnu.org/software/sed/)
107105
- To test if it is available, run `sed --version`.
108106
This should return 4.3 or later.
@@ -289,7 +287,7 @@ or applications into via AWS CodePipeline *(this can be updated later)*.
289287

290288
When deploying ADF for the first time, part of the installation process will
291289
automatically create an AWS CodeCommit repository in the management AWS Account
292-
within the `us-east-1` region. It will also make the initial commit to the
290+
within the `us-east-1` or `cn-north-1` region. It will also make the initial commit to the
293291
default branch of this repository with a default set of examples that act as a
294292
starting point to help define the AWS Account bootstrapping processes for your
295293
Organization.
@@ -330,7 +328,7 @@ To gather the values, you can either find them in the
330328
`aws-deployment-framework-bootstrap` repository in the `adfconfig.yml`
331329
file. Or by looking up the values that were specified the last time ADF got
332330
installed/updated via the CloudFormation template parameters of the
333-
`serverlessrepo-aws-deployment-framework` stack in `us-east-1`.
331+
`serverlessrepo-aws-deployment-framework` stack in `us-east-1` or `cn-north-1`.
334332

335333
#### Stack Name
336334

@@ -352,6 +350,7 @@ Value to use depends on the AWS partition it is deployed to:
352350

353351
- For the AWS partition (most common), use; `us-east-1`
354352
- For the US-Gov partition, use: `us-gov-west-1`
353+
- For the China partition, use `cn-north-1`
355354

356355
**Explanation:**
357356
ADF needs to be deployed in the region where the control plane of the
@@ -517,7 +516,7 @@ This can always be updated later via the `adfconfig.yml` file.
517516

518517
You don't need to include the main region in this list. For example, if you
519518
use the example values for the default region and target regions, it will allow
520-
pipelines to deploy to `eu-west-1`, `eu-central-`, and `us-east-1`.
519+
pipelines to deploy to `eu-west-1`, `eu-central-`, `cn-north-1` and `us-east-1`.
521520

522521
*This is not required when performing an update between versions of ADF.*
523522
*Only supported when installing ADF for the first time.
@@ -647,8 +646,8 @@ automatically in the background, to follow its progress:
647646

648647
1. Please navigate to the AWS Console in the AWS Management account.
649648
As the stack `serverlessrepo-aws-deployment-framework` completes you can now
650-
open AWS CodePipeline from within the management account in `us-east-1` and
651-
see that there is an initial pipeline execution that started.
649+
open AWS CodePipeline from within the management account in `us-east-1` or
650+
`cn-north-1` and see that there is an initial pipeline execution that started.
652651

653652
Upon first installation, this pipeline might fail to fetch the source
654653
code from the repository. Click the retry failed action button to try again.
@@ -693,7 +692,7 @@ automatically in the background, to follow its progress:
693692
that started the bootstrap process for the deployment account. You can view
694693
the progress of this in the management account in the AWS Step Functions
695694
console for the step function `AccountBootstrappingStateMachine-` in the
696-
`us-east-1` region.
695+
`us-east-1` or `cn-north-1` region.
697696

698697
3. Once the Step Function has completed, switch roles over to the newly
699698
bootstrapped deployment account in the region you defined as your main

docs/samples-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Management Account. By default, there is a `global.yml` in the root of the
7070
be appended to as required.
7171

7272
If we look at AWS Step Functions in the management account in `us-east-1`
73-
we can see the progress of the bootstrap process.
73+
or `cn-north-1` we can see the progress of the bootstrap process.
7474

7575
![run-state-machine](./images/run-state-machine.png)
7676

docs/user-guide.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,8 @@ There are five different styles that one could choose from.
980980
method](https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html).
981981
- In case the bucket is stored in `us-east-1`, it will return:
982982
`https://s3.amazonaws.com/${bucket}/${key}`
983+
- In case the bucket is stored in `cn-north-1` or `cn-northwest-1`, it will return:
984+
`https://${bucket}.s3.${region}.amazonaws.cn/${key}`
983985
- In case the bucket is stored in any other region, it will return:
984986
`https://s3-${region}.amazonaws.com/${bucket}/${key}`
985987
- `virtual-hosted` style, will return the S3 location using the virtual hosted

src/lambda_codebase/initial_commit/bootstrap_repository/adf-bootstrap/deployment/global.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,10 @@ Resources:
809809
commands:
810810
- aws s3 cp s3://$SHARED_MODULES_BUCKET/adf-build/ ./adf-build/ --recursive --only-show-errors
811811
- aws s3 cp --sse aws:kms --sse-kms-key-id $ADF_PIPELINE_ASSET_KMS_ARN ./adf-build/templates/ s3://$ADF_PIPELINE_ASSET_BUCKET/adf-build/templates/ --recursive --only-show-errors
812+
- |
813+
if [ "${AWS::Region}" = "cn-north-1" ]; then
814+
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
815+
fi
812816
- pip install -r adf-build/requirements.txt -r adf-build/helpers/requirements.txt -q -t ./adf-build
813817
pre_build:
814818
commands:
@@ -1193,7 +1197,7 @@ Resources:
11931197
StringEquals:
11941198
aws:PrincipalOrgID: !Ref OrganizationId
11951199
ArnLike:
1196-
aws:PrincipalArn: 'arn:aws:iam::*:role/adf-codecommit-role'
1200+
aws:PrincipalArn: !Sub 'arn:${AWS::Partition}:iam::*:role/adf-codecommit-role'
11971201
Resource:
11981202
- !Sub arn:${AWS::Partition}:s3:::${PipelineBucket}/*
11991203
Principal:

0 commit comments

Comments
 (0)