Skip to content

CCM-12224: inline standard lambda policies to reduce policy resource usage#122

Merged
harrim91 merged 1 commit intomainfrom
feature/CCM-11163_inline-lambda-policies
Sep 17, 2025
Merged

CCM-12224: inline standard lambda policies to reduce policy resource usage#122
harrim91 merged 1 commit intomainfrom
feature/CCM-11163_inline-lambda-policies

Conversation

@harrim91
Copy link
Copy Markdown
Contributor

@harrim91 harrim91 commented Sep 16, 2025

Description

Replaces managed IAM policy resources with inline policies in Lambda module.

Context

We're hitting IAM Policy resource limits in template-management dev. Looking at some sandbox environments, it looks like each sandbox env has

  • 21 lambda functions
  • 50 IAM policies

The lambda-related IAM policies in each environment include:

  • 18 "main" policies (permissions specific to that lambda)
  • 20 "logging" policies (allowing the lambda to write logs)
  • 4 "publish" policies (allowing the lambda to publish to SNS when enable_dlq_and_notifications is true)
  • 4 "send_message" policies (allowing the lambda to send to SQS DLQ when enable_dlq_and_notifications is true)

This replaces the "logging", "publish" and "send_message" policy resources and adds them as inline policies on the lambda role.

You can have an unlimited number of inline policies up to a total of 10240 characters attached to a role. Here I'm attaching 3 policies, and the total characters will be well under the character limit.

I've left the "main" policy as a managed policy resource as it gives you a 6144 character limit which is separate from the inline limit.

But as an example, this change should reduce the number of IAM policies per templates sandbox environment from 50 to 22.

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@harrim91 harrim91 requested a review from a team as a code owner September 16, 2025 15:08
Copy link
Copy Markdown
Contributor

@aidenvaines-cgi aidenvaines-cgi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whilst Policy Attachments is prefered over InLine policies this PR drops from 50 to 22 in just the Template Management repo making IAM limits less of a problem

@harrim91 harrim91 changed the title CCM-11163: inline standard lambda policies to reduce policy resource usage CCM-12224: inline standard lambda policies to reduce policy resource usage Sep 17, 2025
@harrim91 harrim91 added this pull request to the merge queue Sep 17, 2025
Merged via the queue into main with commit 0a6f3cc Sep 17, 2025
48 checks passed
@harrim91 harrim91 deleted the feature/CCM-11163_inline-lambda-policies branch September 17, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants