forked from aws/aws-lambda-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.ps1
60 lines (42 loc) · 2.49 KB
/
bootstrap.ps1
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
param (
[Parameter(Mandatory = $true, HelpMessage = "Pipeline Account ID.")]
[string] $PipelineAccountId,
[Parameter(Mandatory = $true, HelpMessage = "Code Commit Account ID.")]
[string] $CodeCommitAccountId,
[Parameter(Mandatory = $true, HelpMessage = "Region.")]
[string] $Region,
[Parameter(Mandatory = $true, HelpMessage = "Source repository ARN.")]
[string] $SourceRepositoryArn,
[Parameter(Mandatory = $true, HelpMessage = "Source branch name.")]
[string] $SourceBranchName,
[Parameter(Mandatory = $false, HelpMessage = "ECR URI to store Stage images.")]
[string] $StageEcr,
[Parameter(Mandatory = $false, HelpMessage = "Semicolon separated ECR URIs to store Beta images.")]
[string] $BetaEcrs,
[Parameter(Mandatory = $false, HelpMessage = "Semicolon separated ECR URIs to store Prod images.")]
[string] $ProdEcrs,
[Parameter(Mandatory = $true, HelpMessage = "ECR repository name for Stage, Beta and Prod images.")]
[string] $EcrRepositoryName,
[Parameter(Mandatory = $true, HelpMessage = "AWS Profile used to created resources.")]
[string] $Profile,
[Parameter(Mandatory = $true, HelpMessage = "AWS Profile for the CodeCommmit AWS account.")]
[string] $CodeCommitAccountProfile,
[Parameter(Mandatory = $true, HelpMessage = "The target .NET framework to create a pipeline for.")]
[string] $TargetFramework,
[Parameter(Mandatory = $true, HelpMessage = "The .NET channel corresponding to the Target Framework.")]
[string] $DotnetChannel
)
$env:AWS_LAMBDA_PIPELINE_ACCOUNT_ID = $PipelineAccountId
$env:AWS_LAMBDA_PIPELINE_CODECOMMIT_ACCOUNT_ID = $CodeCommitAccountId
$env:AWS_LAMBDA_PIPELINE_REGION = $Region
$env:AWS_LAMBDA_SOURCE_REPOSITORY_ARN = $SourceRepositoryArn
$env:AWS_LAMBDA_SOURCE_BRANCH_NAME = $SourceBranchName
$env:AWS_LAMBDA_STAGE_ECR = $StageEcr
$env:AWS_LAMBDA_BETA_ECRS = $BetaEcrs
$env:AWS_LAMBDA_PROD_ECRS = $ProdEcrs
$env:AWS_LAMBDA_ECR_REPOSITORY_NAME = $EcrRepositoryName
$env:AWS_LAMBDA_DOTNET_FRAMEWORK_VERSION = $TargetFramework
$env:AWS_LAMBDA_DOTNET_FRAMEWORK_CHANNEL = $DotnetChannel
npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://$PipelineAccountId/$Region --profile $Profile
npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --trust $PipelineAccountId aws://$CodeCommitAccountId/$Region --profile $CodeCommitAccountProfile
npx cdk deploy --require-approval never --all --profile $Profile