Below is my understanding on assigning policy:

[![enter image description here](https://i.stack.imgur.com/sCnDY.png)](https://i.stack.imgur.com/sCnDY.png)

AWS policy can be assigned to user, group, role but **not to** AWS resource.

In aws policy definition, `Principal` entry has value as user, group or role but not AWS resource(like EC2, serverless lambda etc...)

---

Policy can be assigned to a resource via a role

---

We are creating lambda resource(AWS) using SAM template, as shown below:

```
Resources:
  MyFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      CodeUri: src/
      Handler: index.handler
      Runtime: nodejs4.3
      Policies:

        - SQSPollerPolicy:
            QueueName: name

        - LambdaInvokePolicy:
            FunctionName: name

```

---

but I see `Policies` property as part of the resource definition

---

How can a policy be assigned to a AWS resource(lambda)?