O'Reilly logo

Hands-On Serverless Deep Learning with TensorFlow and AWS Lambda by Rustem Feyzkhanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

serverless.yml

In the serverless.yml file, we can see all the sections that we discussed in the previous chapters, especially the part where we define the role for accessing the query from where we will read messages, and to which our Lambda will write. The following code shows the explanation:

Effect: "Allow"Action:    "sqs:ReceiveMessage"    "sqs:DeleteMessage"    "sqs:GetQueueAttributes"Resource:    arn:aws:sqs:#{AWS::Region}:#{AWS::AccountId}:ReadSQS

We also have to define that one of the queries will act as an event source, as shown:

events:    sqs:      arn:        Fn::GetAtt:          ReadSQS          Arn

Finally, we define the queries, which we can perform in the resource section as shown in the code:

resources:  Resources:     WriteSQS:       Type: AWS::SQS::Queue      Properties: QueueName: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required