1
+ # bootstraps new regions
2
+ #
3
+ # PURPOSE
4
+ # Ensures new regions are deployable in future releases
5
+ #
6
+ # JOB 1 PROCESS
7
+ #
8
+ # 1. Installs CDK
9
+ # 2. Bootstraps region
10
+ #
11
+ # JOB 2 PROCESS
12
+ # 1. Sets up Go
13
+ # 2. Installs the balance script
14
+ # 3. Runs balance script to copy layers between aws regions
15
+
16
+ on :
17
+ workflow_dispatch :
18
+ inputs :
19
+ environment :
20
+ type : choice
21
+ options :
22
+ - beta
23
+ - prod
24
+ description : Deployment environment
25
+ region :
26
+ type : string
27
+ required : true
28
+ description : AWS region to bootstrap (i.e. eu-west-1)
29
+
30
+ name : Region Bootstrap
31
+ run-name : Region Bootstrap ${{ inputs.region }}
32
+
33
+ permissions :
34
+ contents : read
35
+
36
+ jobs :
37
+ cdk :
38
+ name : Install CDK
39
+ runs-on : ubuntu-latest
40
+ permissions :
41
+ contents : write
42
+ id-token : write
43
+ environment : layer-${{ inputs.environment }}
44
+ steps :
45
+ - id : credentials
46
+ name : AWS Credentials
47
+ uses : aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
48
+ with :
49
+ aws-region : ${{ inputs.region }}
50
+ role-to-assume : ${{ secrets.REGION_IAM_ROLE }}
51
+ mask-aws-account-id : true
52
+ - id : workdir
53
+ name : Create Workdir
54
+ run : |
55
+ mkdir -p build/project
56
+ - id : cdk-install
57
+ name : Install CDK
58
+ working-directory : build
59
+ run : |
60
+ npm i aws-cdk
61
+ - id : cdk-project
62
+ name : CDK Project
63
+ working-directory : build/project
64
+ run : |
65
+ npx cdk init app --language=typescript
66
+ AWS_REGION="${{ inputs.region }}" npx cdk bootstrap
67
+
68
+ copy_layers :
69
+ name : Copy Layers
70
+ runs-on : ubuntu-latest
71
+ permissions :
72
+ contents : write
73
+ id-token : write
74
+ strategy :
75
+ matrix :
76
+ layer :
77
+ - AWSLambdaPowertoolsPythonV3-python38-arm64
78
+ - AWSLambdaPowertoolsPythonV3-python39-arm64
79
+ - AWSLambdaPowertoolsPythonV3-python310-arm64
80
+ - AWSLambdaPowertoolsPythonV3-python311-arm64
81
+ - AWSLambdaPowertoolsPythonV3-python312-arm64
82
+ - AWSLambdaPowertoolsPythonV3-python313-arm64
83
+ - AWSLambdaPowertoolsPythonV3-python38-x86_64
84
+ - AWSLambdaPowertoolsPythonV3-python39-x86_64
85
+ - AWSLambdaPowertoolsPythonV3-python310-x86_64
86
+ - AWSLambdaPowertoolsPythonV3-python311-x86_64
87
+ - AWSLambdaPowertoolsPythonV3-python312-x86_64
88
+ - AWSLambdaPowertoolsPythonV3-python313-x86_64
89
+ environment : layer-${{ inputs.environment }}
90
+ steps :
91
+ - id : credentials
92
+ name : AWS Credentials
93
+ uses : aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
94
+ with :
95
+ aws-region : us-east-1
96
+ role-to-assume : ${{ secrets.REGION_IAM_ROLE }}
97
+ mask-aws-account-id : true
98
+ - id : go-setup
99
+ name : Setup Go
100
+ uses : actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
101
+ - id : go-env
102
+ name : Go Env
103
+ run : go env
104
+ - id : go-install-pkg
105
+ name : Install
106
+ run : go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@latest
107
+ - id : run-balance
108
+ name : Run Balance
109
+ run : balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name ${{ matrix.layer }} -dry-run false
0 commit comments