# CreateLogGroup & PutLogEvents policies are getting too large

**URL:** <https://forum.serverless.com/t/createloggroup-putlogevents-policies-are-getting-too-large/9698>\
**Category:** Serverless Framework\
**Tags:** aws, cloudformation\
**Created:** [October 25, 2019, 4:24am UTC](https://forum.serverless.com/t/createloggroup-putlogevents-policies-are-getting-too-large/9698 "2019-10-25T04:24:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mess-lelouch](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@mess-lelouch](https://forum.serverless.com/u/mess-lelouch)\
**Post date:** [October 25, 2019, 4:24am UTC](https://forum.serverless.com/t/createloggroup-putlogevents-policies-are-getting-too-large/9698/1 "2019-10-25T04:24:45Z")

</div>

Hello folks!

I hope you could help me here. Recently I hit the 10240 byte IAM role policy limit when deploying my stack. I was inspecting the generated template and I observed that the CreateLogGroup and PutLogEvents clauses are large because they list all of the functions in my stack. For example:

```
          "Effect": "Allow",
          "Action": [
            "logs:CreateLogStream"
          ],
          "Resource": [
            {
              "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/foo-function:*"
            },
            {
              "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/bar-function:*"
            },
            ...

```

I think I read somewhere that it adds an explicit entry in the Resources section for each function in my stack because I explicitly name them. Above is just an example, but I have over 20 functions and this makes the policy very large since the same happens with PutLogEvents.

Is there a way to avoid this? For example, can I tell the framework to not create this part of the policy so that I can create it manually? I looked everywhere and could not find anything useful.

Any advice is welcome and will be greatly appreciated.

Best regards,

- mess

---

<div class="post-metadata">

**Author:** ![bfieber](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bfieber/32/653_2.png) [@bfieber](https://forum.serverless.com/u/bfieber)\
**Post date:** [October 25, 2019, 3:24pm UTC](https://forum.serverless.com/t/createloggroup-putlogevents-policies-are-getting-too-large/9698/2 "2019-10-25T15:24:08Z")

</div>

Have a look at [Custom IAM Roles](https://serverless.com/framework/docs/providers/aws/guide/iam#custom-iam-roles) in the Serverles documentation.  
There you can get very detailed and control every aspect of your IAM permissions.

Hope it helps.

---

<div class="post-metadata">

**Author:** ![mess-lelouch](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@mess-lelouch](https://forum.serverless.com/u/mess-lelouch)\
**Post date:** [October 25, 2019, 6:28pm UTC](https://forum.serverless.com/t/createloggroup-putlogevents-policies-are-getting-too-large/9698/3 "2019-10-25T18:28:29Z")

</div>

That works for me. Thanks a lot!
