Hands-On Practice: AWS IoT Device Shadow
Intro - What is AWS IoT Device Shadow?In real world, sometime it is difficult to get the actual device state in real time in such IoT scenarios. A device shadow can overcome this challenge, Device Shadow can consider a virtual virtual representation of a device which managed by the IoT Things resource created in AWS IoT Core. The Shadow document is a JSON or a JavaScript notation doc that is used to store and retrieve the current state information for a device. You can use the shadow to get...
Hands-On Practice: Amazon SNS Fan out to Amazon SQS
IntroductionAmazon SNS offen works well with Amazon SQS, by subscribing SQS to SNS, the SNS service can push messages to SQS. This may eliminating the need to periodically check or “poll” for updates. What is Amazon SQS?By official definition Amazon SQS is a message queue service used by distributed applications to exchange messages through a polling model, and can be used to decouple sending and receiving components—without requiring each component to be concurrently available. Scenario T...
Hands-On Practice: S3 Gateway Endpoints
What is S3 Gateway Endpoints? Let’s consider a scenario How could your Lambda function access the content in the S3 bucket? If you want a service to access the content in the S3 bucket, it usually go through VPC endpoint. S3 supports two types of VPC endpoint,each of which is Gateway endpoint and Interface endpoint The diffeences between two types of VPC endpoints are listed below S3 Gateway Endpoints S3 Interface Endpoints Use S3 Public IP Address Use Private IP Address in VPC to a...
Lambda_layer 概念和實作
前言針對 Lambda 設定,絕大多數人一定碰過 ImportModuleError 所以各位可以跟著以下的情境,開一個一樣的 Lambda 環境逐步操作。 情境 Region: IAD(us-east-1) Runtime: Python3.11 Lambda Name: “ITHomeLambdaFunction” Lambda code1234567891011import json requestsdef lambda_handler(event, context): # TODO implement x = requests.get('https://www.ntust.edu.tw/') print(x.text) return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } [Error]: Runtime.ImportModu...
AWS Lambda知識整理 | 佈建並行 | 預留並行
回顧前面有提及了 Lambda 的基本介紹、Lambda Runtime、權限配置 以及從日誌上觀察初始化時間以及函數執行時間。 最後我們有提到一個問題,那就是 如果我們用 AWS CLI 去調用 Lambda 函數,用 Terminal 一次開三個Tab同時調用我們的 Lambda 函數會發生什麼事? 實驗一 - 設置 Reserved Concurrency我們執行以下指令: 12345aws lambda invoke \ --function-name TestInvocations \ --cli-binary-format raw-in-base64-out \ --payload '{ "name": "test" }' \ response.json 事實上他都可以成功,並且會在 CloudWatch 上產生三筆Log Stream。 但如果我們去設定動一點手腳,我們將某個叫做 Reserved Concurrency 的設定調整成1,並按下 save...
Lambda 基本認識 feat.容器重用小實驗
前言首先,為什麼談到無伺服器總是會有人提到 Lambda ? 以下就開始來介紹這個服務 FaaS (Function as a Service)一旦談到無伺服器運算,就會提到他的核心概念,功能即服務(Function as a Service) ,這裡引用維基百科對於 FaaS 的解釋 FaaS 是雲端運算的一種模型。以平台即服務(PaaS)為基礎,無伺服器運算提供一個微型的架構,終端客戶不需要部署、配置或管理伺服器服務,程式碼運行所需要的伺服器服務皆由雲端平台來提供。 沒錯,這個概念的核心就是讓使用者專注在設計產品或業務邏輯,而不需費心在部署配置或是設定伺服器。 而最早實踐這個概念並推出服務的,就是 AWS 在 2014 年推出的 Lambda 服務。(當然後續也有 Microsoft 的 Azure Function) Lambda 函數 Lambda 在高可用性的運算基礎設施上執行您的程式碼,並執行所有運算資源的管理,包括伺服器與作業系統維護、容量佈建與自動擴展以及記錄。使用 Lambda,您唯一需要做的就是在 Lambda 支援的其中一種語言執行期中提供您的程式碼 [...
帶你從零開始整合 Lambda Function 到 Amazon Connect
前言在現代的商業環境中,提供優質且高效的客戶服務是成功的關鍵之一。Amazon Connect 是一個強大的雲端客戶服務中心,它可以幫助企業輕鬆建立高度可靠的聯絡中心,並與客戶進行無縫的互動。本篇技術部落格文章將帶領您逐步了解如何整合 Lambda Function 到 Amazon Connect,以實現更多自定義的功能。 在這篇文章中,我們將遵循以下步驟來實現整合: 步驟一、建立 Connect Instance首先,我們將在 Amazon Connect Console 上建立一個 Connect Instance。 請至 Amazon Connect Console 上選擇 Add Instance。這個步驟會需要設定你的 instance-alias,這樣可以為你的connect instance 建立一個 unique的 Access URL 這個步驟是添加Admin,你會需要設定使用者名稱以及密碼。 之後的步驟我們就都按 Next,最後建立 Instance。 建立會需要等一段時間,可以趁這個時候建立 Lambda Funciton 步驟二、建立 Lambd...
⚙️在 Lambda 上設定錯誤重試 (Retry)
前言一樣是解 case 碰到的問題,但我也沒真的在 Lambda 設定過重試 (Retry),這次就秉持著實驗精神來在自己的環境實驗看看。 Lambda 當中的錯誤重試通常是用於當非同步調用(Asynchronous Invocations) 失敗後重新發送調用請求的行為。針對非同步調用,Lambda 會將事件置放在 Queue 當中,並傳回成功回應,其中不包含其他資訊。單獨的程序會從 Queue 讀取事件,並將事件傳送到您的函數 圖片用 ZenUML 建立的https://app.zenuml.com/https://mermaid.js.org/syntax/zenuml.html 建立 Lambda這邊建立 Lambda部分很簡單,就建立一個名叫 TestInvocations 的 function,使用的 Runtime 是 NodeJS.14.x 修改 Lambda Handler 程式在 Lambda Console主頁底下的 Code 區域來修改程式,更改 index.js 12345678let outside = 0;exports.handler = (...
🐞透過 Amazon Lambda 實踐 Web Crawler
前言這篇文章是在重現客戶問題時候的的實踐,原先為了解決客戶的問題,我試著想要安裝 Selenium Chromedriver 以及 BeautifulSoup ,打包成 Lambda Layer 並建立基於該Layer的Lambda,但一直出現 Chromedriver 找不到檔案的錯誤,左踩坑又踩坑的troubleshooting 突然這篇救星 https://stackoverflow.com/questions/69047401/selenium-docker-container-runs-on-ec2-but-not-on-aws-lambda ,根據這篇文章以及相對應的 github https://github.com/rchauhan9/image-scraper-lambda-container/tree/master,上面主要是以 Container Image 的方式來建立 Lambda ,但要這麼做之前會先將需要的套件跟環境打包成 Image。 但由於公司的 Mac 不能安裝 Docker,因此我先開個 EC2 來進行大部分操作 本篇文章的範例以及建構所需知...
我的第一篇文章
從 Hugo 移植到 Hexo之前在 Hugo 雖然就挺方便的,但這個 Butterfly 主題真的太贊了,就先移植過來玩看看












