---
# System prepended metadata

title: '[DevAx::Academy][.Net][Module 6] CloudMaster x Syscom'

---

#  [DevAx::Academy][.Net][Module 6] CloudMaster x Syscom

- Short URL to this page ---> https://pse.is/4jn886 <-----
- Full URL to this page https://hackmd.io/cUvQcfngT3i41ilq54SY2g


會議室連結: https://chime.aws/1030627039
Survey: https://survey.immersionday.com/8KU-HHHVR

## Overview ##


本次 Lab 請使用 us-east-1 US East (N. Virginia) (https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html)


### Lab Document ###
- .Net: https://workshops.devax.academy/monoliths-to-microservices-dotnet/
- Java: https://workshops.devax.academy/monoliths-to-microservices/

### Other resources ###
JWT https://medium.com/%E9%BA%A5%E5%85%8B%E7%9A%84%E5%8D%8A%E8%B7%AF%E5%87%BA%E5%AE%B6%E7%AD%86%E8%A8%98/%E7%AD%86%E8%A8%98-%E9%80%8F%E9%81%8E-jwt-%E5%AF%A6%E4%BD%9C%E9%A9%97%E8%AD%89%E6%A9%9F%E5%88%B6-2e64d72594f8

### AWS Event Engine (Lab 環境有效時間72小時)###
- https://dashboard.eventengine.run/login?hash=490a-1537ab0b44-fa

選擇 One-time password (OTP) 
![](https://i.imgur.com/Jf3cEhi.png)

設定一個 Team Name (e.g. AWS Jack Hsu)
![](https://i.imgur.com/1QP4COx.png)
![](https://i.imgur.com/eOXYYQQ.png)


Login EC2
- https://workshops.devax.academy/monoliths-to-microservices-dotnet/module0/remote_environment/install_cli/provided_account.html



## Step.0 Configure local machine AWS CLI

將以下 code 複製到記事本，接著到 Event Engine 內取得 access keys 更新 code 內的 keys。開啟一個 terminal 貼上，即可在該 terminal 內使用 aws cli。

```
aws configure set profile.devaxacademy.region us-east-1
aws configure set profile.devaxacademy.aws_access_key_id ASIAWLBJNxxxxxx
aws configure set profile.devaxacademy.aws_secret_access_key 0kKlyvxxxxx
aws configure set profile.devaxacademy.aws_session_token IQoJb3JpZ2luX2VjELz...很長一串

# 跑這行看到 JSON 表示成功
aws sts get-caller-identity --profile devaxacademy
{
    "UserId": "AROAWLBJNXZLY2YXVVJKB:MasterKey",
    "Account": "436026064471",
    "Arn": "arn:aws:sts::436026064471:assumed-role/TeamRole/MasterKey"
}
```

## Lab 6.1 ##


### Lab 6.1.2  ###

step 96 
execute below command under src/Hotelspecials
`dotnet lambda package`


### Lab 6.1.3 Create And Expose the API with Amazon API Gateway
step 96 
execute below command under src/Hotelspecials
`dotnet lambda package`

step 97
in cloudformation template, line 89 remove StageName


### Lab 6.1.4 Deploy the API Using CodeCommit and CodePipeline
step 5
Create a new branch in git for the new implementation you are about to create. Call the new branch new-implementation.
`git checkout -b "new-implementation"`

step 11
in cloudformation template, line 89 remove StageName

step 17 
```
git status
git add .
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
```

step 18
amazon linux 2 Image version standard:3.0

Step 19 - buildspec.yml

修改 Line 25 <S3BucketLambdaCodeBucketName>

IAM

搜尋 Role "codebuild-FlightSpecialsAPIBuild-service-role"
Permissions policies -> Add permissions 按鈕 -> 搜尋 "AdministratorAccess" -> 打勾 附加 


*若需要重新 commit 變更檔案，可以直接使用下列指令 add, commit and push
```
git add .
git commit -m "Initial check-in"
git push origin
```



### Lab 6.1.5 Setup The Single Page Application Website
step 16 
change region or copy index.html url directly

    
## Lab 6.2 ##
    
### Lab 6.2.2 Setting Up Authentication For The Microservice
step 17
If you can't see travelBuddy option refresh the page.



## Lab 6.3 X-Ray ##
    
Step 1. Lambda idevelopTripSearchFull -> Configuration -> Active tracing
Step 2. API Gateway iDevelop - Trip Search API -> Stage -> prod -> Logs/Tracing -> Enable X-Ray Tracing 打勾
    
Step 3. 到 API Gateway Invoke 幾次查詢
    
Invoke URL: https://rl01m9jk2l.execute-api.us-east-1.amazonaws.com/prod
Invoke URL: https://rl01m9jk2l.execute-api.us-east-1.amazonaws.com/prod/trips

Step 4. X-Ray 去查詢 Service Maps (有時會延遲 3-5鐘才有效能數據)
    
    
## Q&A ##
    
    