Mở console Lambda, chọn Create function.
Chat-Proxy.
Mở Additional settings:
FCJ-ChatApp-Lambda-Role.
Ở tab Code, thay nội dung index.mjs bằng code trong v3/Lambda/Chat-Proxy.mjs. Đổi <your bucket name> thành tên bucket của bạn rồi chọn Deploy. Bạn cũng có thể deploy từ CloudShell:
mkdir -p ~/fn && cd ~/fn
sed "s/<your bucket name>/$BUCKET/" ~/ws2-chatapp/v3/Lambda/Chat-Proxy.mjs > index.mjs && zip -q proxy.zip index.mjs
aws lambda update-function-code --function-name Chat-Proxy --zip-file fileb://proxy.zip --query LastUpdateStatus --output text
data/conversations.json trong bucket của bạn.
Mở tab Test, tạo event tên Get-Data-From-S3 với JSON {}, chọn Save rồi Test.
statusCode 200, body chứa hai cuộc trò chuyện đọc từ S3.