-
Notifications
You must be signed in to change notification settings - Fork 421
94 lines (90 loc) · 2.98 KB
/
bootstrap_region.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
on:
workflow_dispatch:
inputs:
environment:
type: choice
options:
- beta
- prod
description: Deployment environment
region:
type: string
required: true
description: AWS region to bootstrap (i.e. eu-west-1)
name: Region Bootstrap
run-name: Region Bootstrap ${{ inputs.region }}
permissions:
contents: read
jobs:
cdk:
name: Install CDK
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
environment: layer-${{ inputs.environment }}
steps:
- id: credentials
name: AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: ${{ inputs.region }}
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
mask-aws-account-id: true
- id: workdir
name: Create Workdir
run: |
mkdir -p build/project
- id: cdk-install
name: Install CDK
working-directory: build
run: |
npm i aws-cdk
- id: cdk-project
name: CDK Project
working-directory: build/project
run: |
npx cdk init app --language=typescript
AWS_REGION="${{ inputs.region }}" npx cdk bootstrap
copy_layers:
name: Copy Layers
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
strategy:
matrix:
layer:
- AWSLambdaPowertoolsPythonV3-python38-arm64
- AWSLambdaPowertoolsPythonV3-python39-arm64
- AWSLambdaPowertoolsPythonV3-python310-arm64
- AWSLambdaPowertoolsPythonV3-python311-arm64
- AWSLambdaPowertoolsPythonV3-python312-arm64
- AWSLambdaPowertoolsPythonV3-python313-arm64
- AWSLambdaPowertoolsPythonV3-python38-x86_64
- AWSLambdaPowertoolsPythonV3-python39-x86_64
- AWSLambdaPowertoolsPythonV3-python310-x86_64
- AWSLambdaPowertoolsPythonV3-python311-x86_64
- AWSLambdaPowertoolsPythonV3-python312-x86_64
- AWSLambdaPowertoolsPythonV3-python313-x86_64
environment: layer-${{ inputs.environment }}
steps:
- id: credentials
name: AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
mask-aws-account-id: true
- id: go-setup
name: Setup Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
- id: go-env
name: Go Env
run: go env
- id: go-install-pkg
name: Install
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@latest
- id: run-balance
name: Run Balance
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name ${{ matrix.layer }} -dry-run false