Tạo Extraordinary rides service

Tạo Extraordinary rides service

Sau khi đã tạo SNS subscription bằng console, chúng ta sẽ thử tạo subscription SNS bằng SAM.

  1. Cập nhật AWS SAM template
  • Mở file code/lab-1/template.yaml trong VS Code và cập nhật đoạn code sau
Events:
  SNSEvent:
    Type: SNS
    Properties:
      Topic: !Ref RideCompletionTopic
      FilterPolicy:
        fare:
          - numeric:
              - '>='
              - 50
        distance:
          - numeric:
              - '>='
              - 20

Working with SNS

  1. Cập nhật bằng lệnh sau:
cd ~/wild-rydes-async-messaging/code/lab-1
sam build --use-container

Working with SNS

  1. Sau khi cập nhật, chúng ta sẽ triển khai bằng lệnh:
sam deploy

Working with SNS

  1. Kiểm tra subscription đã tạo thành công.

Working with SNS

  1. Kiểm tra Lambda Function đã trigger SNS.

Working with SNS