-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy.ps1
57 lines (51 loc) · 2.94 KB
/
deploy.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
Write-Output "This deployment will use the following User Id and Account: `r`n"
aws sts get-caller-identity
#############################################################
# Deploy WebAPI microservice: #
#############################################################
# 1. Navigate to the CDK project folder for the WebAPI;
# 2. Bootstrap your environment, account, and region to run the CDK project;
# 3. Synthesize the project to validate the implementation and produce the CloudFormation template to be deployed;
# 4. Deploy the CloudFormation Stack after your confirmation;
# 5. Query the VPC ID created from the first Stack and export it to a local environment variable DEMO_VPC_ID
# 6. Query the DemoDeployRegion created from the first Stack and export it to a local environment variable CDK_DEPLOY_REGION
# 7. Navigate back to the root folder
Set-Location WebAPI/src/infra/
cdk bootstrap
cdk synth
cdk deploy --require-approval never
$Env:DEMO_VPC_ID = $(aws cloudformation describe-stacks --stack-name WebAppInfraStack --output text --query 'Stacks[0].Outputs[?OutputKey==`DemoVpcId`].OutputValue | [0]')
$Env:CDK_DEPLOY_REGION = $(aws cloudformation describe-stacks --stack-name WebAppInfraStack --output text --query 'Stacks[0].Outputs[?OutputKey==`DemoDeployRegion`].OutputValue | [0]')
Set-Location ../../../
#############################################################
# Deploy the first Worker Services microservices #
#############################################################
# 1. Navigate to the CDK project folder for the Worker Service that persists into DynamoDB
# 2. Then synthesize
# 3. and deploy the Stack.
# 4. Navigate back to the root folder
Set-Location ServicesWorkerDb/src/infra/
cdk synth
cdk deploy --require-approval never
Set-Location ../../../
#############################################################
# Deploy the second Worker Services microservices #
#############################################################
# 1. Navigate to the CDK project folder for the Worker Service that persists into S3 Bucket
# 2. Then synthesize
# 3. and deploy the Stack.
# 4. Navigate back to the root folder
Set-Location ServicesWorkerIntegration/src/infra/
cdk synth
cdk deploy --require-approval never
Set-Location ../../../
#############################################################
# Echo the WebAPI URL #
#############################################################
Write-Output "`r`n"
Write-Output "#############################################################"
Write-Output "# the WebAPI URL #"
Write-Output "#############################################################"
Write-Output "`r`n"
aws cloudformation describe-stacks --stack-name WebAppInfraStack --output text --query 'Stacks[0].Outputs[?contains(OutputKey,`DemoServiceServiceURLEndpoint`)].OutputValue | [0]'
Write-Output "`r`n"