老布這麼說
Yet another bootstrap theme.
2022-09-13
Read More
2022-09-05
2022-08-30
有關 lambda performance 的相關資料
Reference
- Operating Lambda: Performance optimization – Part 1 | AWS Compute Blog
- Operating Lambda: Performance optimization – Part 2 | AWS Compute Blog
同場加映
2022-08-23
在使用 pytest 時,有些 test-case 是在 開發 階段才需要跑。上到 daily job 時,可以跳過這些 test-case
找了一下 pytest 的作法,可以用 mark
的方式達成
Reference
2022-08-18
近期在修改 api-gateway 中 custom authorizer 回傳的錯誤訊息。
原本是希望可以回傳 http status code 400 的錯誤,試了一段時間後。因為是以 custom authorizer 的方式實作,在 auth 中,僅能回傳 401 & 403 的錯誤
Reference
- Introducing custom authorizers in Amazon API Gateway | AWS Compute Blog overall 的說明 blog
- awslabs/aws-apigateway-lambda-authorizer-blueprints: Blueprints and examples for Lambda-based custom Authorizers for use in API Gateway. 以這份參考,來修改 python custom authorizer 的實作
- Use API Gateway Lambda authorizers - Amazon API Gateway 使用 lambda 來實作 api-gateway custom authorizer 的說明文件
- Output from an Amazon API Gateway Lambda authorizer - Amazon API Gateway lambda authorizer 回傳的結果。
- 其中回傳 json 中,所帶的
context
資料,會傳到下個 lambda 的event
變數中
- 其中回傳 json 中,所帶的
2022-08-17
Read More
2022-08-17
在使用 AWS RDS 的過程中,大多會將 RDS 建立於 private subnet 中。local 電腦要連時,則會透過 bastion server 連。
當使用 DataGrip 這類 IDE 時,則需要在 IDE 中,設定連到 private subnet 的方式
Step
- 建立 DataSource
- 因為要透過 bastion server,因而要設定 ssh tunnel。可以讀
~/.ssh/config
設定,還滿方便的 - 接著要記得將 Drive 切換成
Amazon Aurora MySQL
才可以正常連線 ** 這部我卡了很久,才試出來 - 連 MySQL 的部分,要用 private ip,自行先用
nslookup
查過
Reference
- Can’t connect to remote MySQL since last version of IntelliJ : DBE-13313 就是在這篇長長的討論中,有看到可以換 MySQL 的 driver
- For Aurora MySQL it’s recommended to use a dedicated driver in DataGrip
- Connect to an Amazon RDS DB instance using a bastion host from a Linux machine
2022-08-17
ssh tunnel 設定的參考
ssh -i <identity_file> -f -l <bastion-host-username> -L <local-port-you-connect-to>:<rds-endpoint>:<rds:listening-port> <bastion-host-public-ip> -v
- Example Command
ssh -i "private_key.pem" -f -l ec2-user -L 5432:172.31.39.62:5432 3.133.141.189 -v
Reference
- Connect to an Amazon RDS DB instance using a bastion host from a Linux machine
- 有成功使用 Syntax 1 的方式連
- Using a Jump host to access an RDS database in a private subnet
- Simplify your day with SSH config file entries and self closing tunnels
- 原本想說直接設定在 ssh config 就好,不過,試的過程有遇到問題,還試不出來
2022-08-16
Read More
2022-08-12
Read More