Skip to content

IAM policy editor won't let me save a 679 character policy - says it's > 2048

0

I'm getting this error while trying to save my policy - Enter image description here

Here is the policy:


{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowReadEKSNodegroupSLR",
            "Effect": "Allow",
            "Action": "iam:GetRole",
            "Resource": "arn:aws:iam::330899370541:role/aws-service-role/eks-nodegroup.amazonaws.com/AWSServiceRoleForAmazonEKSNodegroup"
        },
        {
            "Sid": "AllowCreateEKSNodegroupSLR",
            "Effect": "Allow",
            "Action": "iam:CreateServiceLinkedRole",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "iam:AWSServiceName": "eks-nodegroup.amazonaws.com"
                }
            }
        }
    ]
}

This is not 2048 characters, so should not error. How do I fix this?

2 Answers
0

The error you're encountering is likely not related to the actual character count of your policy, but rather to how the IAM policy editor is processing your policy.

Your policy is indeed well under the 2048 character limit (it's only 679 characters as you mentioned). This suggests there might be an issue with the policy editor interface rather than with your policy itself.

Here are some troubleshooting steps you can try:

  1. Try switching between the visual editor and JSON editor options in the IAM console.

  2. Clear your browser cache and cookies, then try again.

  3. Try using a different browser to edit and save the policy.

  4. Instead of using the console, consider using the AWS CLI or API to create or update this policy.

  5. If you're editing an existing policy, try creating a new policy instead and then delete the old one.

  6. Validate your policy using IAM Access Analyzer to ensure there are no syntax errors that might be causing issues.

The policy itself looks valid from a syntax perspective, so this appears to be an interface or browser-related issue rather than a problem with your actual policy content.
Sources
Troubleshoot IAM policies - AWS Identity and Access Management
IAM policy validation - AWS Identity and Access Management

answered a year ago

EXPERT

reviewed a year ago

0

I am able to create the below policy successfully from my end.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowReadEKSNodegroupSLR",
            "Effect": "Allow",
            "Action": "iam:GetRole",
            "Resource": "arn:aws:iam::330899370541:role/aws-service-role/eks-nodegroup.amazonaws.com/AWSServiceRoleForAmazonEKSNodegroup"
        },
        {
            "Sid": "AllowCreateEKSNodegroupSLR",
            "Effect": "Allow",
            "Action": "iam:CreateServiceLinkedRole",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "iam:AWSServiceName": "eks-nodegroup.amazonaws.com"
                }
            }
        }
    ]
}

Enter image description here

AWS
EXPERT

answered a year ago

EXPERT

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.