After creating SNS Topic and subscriptions according to the architecture:
- SNSPublishMessagePolicy:
TopicName: !GetAtt RideCompletionTopic.TopicName
TOPIC_ARN: !Ref RideCompletionTopic
sns = boto3.client('sns', config=config)
response = sns.publish(
TopicArn=TOPIC_ARN,
Message=json.dumps(request),
MessageAttributes = {
'fare': {
'DataType': 'Number',
'StringValue': str(request['fare'])
},
'distance': {
'DataType': 'Number',
'StringValue': str(request['distance'])
}
}
)
cd ~/environment/wild-rydes-async-messaging/lab-1
Sam build
sam deploy