跳到主要內容

發表文章

目前顯示的是有「AWS」標籤的文章

Let'sEncrypt with Spring-boot Https

網路管理基礎 Route53 與網路管理基本概念 EC2 Https 設定 AWS 綁定 Domain Route53 建立 Hosted Zones, 自己申請的 Domain (my-domain.me) Route53 Hosted Zones 建立 Record (my-domain.me), 綁定 EC2 Let’sEncrypt Certificate 申請 1. 安裝 certbot 工具 $ git clone https://github.com/certbot/certbot.git $ cd certbot $ ./certbot-auto 2. 透過 certbot 的 plugin 申請 certificate $ ./certbot-auto certonly —a standalone -d my-domain.me —email someone@gmail.com 在流程中, 需要回答一些問題, LetsEncrypt 會發送 request 去驗證 my-domain.me 這個 domain 3. 使用 openssl 將 letsEncrypt 的 key 產生 ssl 這是 os 環境 letsencrypt 的預設目錄路徑 $ cd /etc/letsencrypt/live/my-domain.me 把 letEncrypt 給你的 private key 產生 ssl 憑證 $ openssl pkcs12 -export -in fullchain.pem \ -inkey privkey.pem \ -out keystore.p12 -name tomcat \ -CAfile chain.pem \ -caname root 把生成的 ssl 憑證, 放到 spring-boot 專案底下的 resouces $ cp keystone.p12 ~/my-web-project/main/resources/ 4. 設定 application-prod.yml server: port: 8443...

DynamoDB 名詞概念

DynamoDB Download Localhost DynamoDB Table 類似於 RDBMS 的 Table. DynamoDB Table 是一個儲存集合單位。 相當於 MongoDB 的 Collection Items 每個 Table 可以有多個 Items,相當於 RDBMS 的 Rows。 每個 Items 可包含多個 Attributes 相當於 MongoDB 的 Document Attributes: 每個 Items 由一個或多個 Attributes 組成 Attributes 支援最深 32 個層級 Example People Table { "PersonID":"101", "LastName":"Simtih", "FirstName":"Fred", "Phone":"123-456", }, { "PersonID":"102", "LastName":"Jones", "FirstName":"Anytown", "Address":{ "Street":"123 Main", "City":"Anytown", "Zip":123 } } Primary Key Partitiion Key 相當於 RDS 的 Unique Key, 有一組不會重複的 hash value Partition Key + Sort Key (複合鍵) 先找到 unique key 再依照 sort key 做索引, hash + range Hash : select * from xxx where id = hash Hash + range : select * from xxx wh...

AWS Kinesis Note

Sample Ec2 Instance(Consumer) | +- Worker + |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) Ec2 Instance(Consumer) | +- Worker + |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) |- Processor <-- shard (shard 的 seqId, partictionId 會被記錄到 DynamoDB) Concept 每一台 Ec2 可視為一個 Consumer,每個 Consumer 會有個 Worker 機制把 shard Stream 分配給 Processor,當 shard 的數量調大的時候,KCL(Kinesis Clinet Libary) 裡面的 IRecordProcessorFactory 就會自動建立對應, shard 的 processor。 當有新的 Consumer 被建立時,AWS 會自動做 loadbalance,去平衡每個 worker 要負責的 shards,這時候 Processor 裡面的 shutdown 會被執行。 切記 Consumer 不應該開的比 shard 的數量還大。