Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates AWS managed policies #1167

Merged
merged 1 commit into from
Feb 27, 2025
Merged

Updates AWS managed policies #1167

merged 1 commit into from
Feb 27, 2025

Conversation

udondan
Copy link
Owner

@udondan udondan commented Feb 27, 2025

Updates AWS managed policies

Summary by CodeRabbit

  • New Features

    • Introduced new conditional permissions for EC2 actions, enhanced role tagging, and untagging capabilities.
    • Added a new policy defining comprehensive permissions for S3, KMS, and SageMaker search functionalities.
  • Refactor

    • Reorganized network interface controls and shifted permissions between role contexts for better access management.
  • Chores

    • Updated the overall managed policies list to reflect the latest policy definitions.

Copy link

coderabbitai bot commented Feb 27, 2025

Walkthrough

The pull request updates AWS managed policies across several JSON files. The AmazonEKSServiceRolePolicy now permits selected EC2 actions with a condition limiting them to EKS-managed resources. Two SageMaker Studio EMR policies are updated: one introduces a new policy file with multiple S3 and KMS statements, while the other adds a condition-based statement for EC2 network interface and instance creation regarding a VPC tag. Additionally, two SageMaker Studio Project policies modify IAM role tagging and permission allocation, including new search capabilities and untagging rules. Finally, index.json is replaced with an updated policy list.

Changes

File(s) Change Summary
docs/.../AmazonEKSServiceRolePolicy.json Added a new statement permitting ec2:DeleteLaunchTemplate and ec2:TerminateInstances on all resources with a condition enforcing that ec2:ManagedResourceOperator is equal to "eks.amazonaws.com".
docs/.../SageMakerStudioEMRInstanceRolePolicy.json
docs/.../SageMakerStudioEMRServiceRolePolicy.json
Introduced a new EMR policy file defining multiple S3 and KMS permissions for the SageMaker Studio EMR Instance Role, and added a new statement (CreateInNetworkForSharedSubnet) in the EMR Service Role to allow EC2 network interface and instance creation actions with a VPC condition based on aws:PrincipalTag/VpcId.
docs/.../SageMakerStudioProjectProvisioningRolePolicy.json
docs/.../SageMakerStudioProjectRoleMachineLearningPolicy.json
Updated project policies by adding the "EnableAmazonBedrockPermissions" to IAM role tagging and a new IAMRoleUntagging statement (targeting specific role ARNs with conditions), and by moving EC2 network interface permissions between statements while also introducing a new "SageMakerSearchPermissions" statement for the sagemaker:Search action.
docs/.../index.json Completely replaced the file content with a new list of AWS managed policies.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/source/_static/managed-policies/SageMakerStudioProjectProvisioningRolePolicy.json (1)

479-495: Condition Value Format in Untagging Statement

The new statement with Sid: "IAMRoleUntagging" permits untagging IAM roles matching "arn:aws:iam::*:role/datazone_usr_role_*". One point to note is the condition block using "ForAllValues:StringLike":

-        "ForAllValues:StringLike": {
-          "aws:TagKeys": "EnableAmazonBedrockIDEPermissions"
-        }
+        "ForAllValues:StringLike": {
+          "aws:TagKeys": [
+            "EnableAmazonBedrockIDEPermissions"
+          ]
+        }

Using a string value directly is allowed if only one tag key is ever expected; however, an array may be clearer if you plan to support additional keys in the future. Please verify that this meets your design intent.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3a40ea and bd2c04f.

⛔ Files ignored due to path filters (2)
  • lib/generated/aws-managed-policies/cdk-iam-floyd.ts is excluded by !**/generated/**
  • lib/generated/aws-managed-policies/iam-floyd.ts is excluded by !**/generated/**
📒 Files selected for processing (6)
  • docs/source/_static/managed-policies/AmazonEKSServiceRolePolicy.json (1 hunks)
  • docs/source/_static/managed-policies/SageMakerStudioEMRInstanceRolePolicy.json (1 hunks)
  • docs/source/_static/managed-policies/SageMakerStudioEMRServiceRolePolicy.json (1 hunks)
  • docs/source/_static/managed-policies/SageMakerStudioProjectProvisioningRolePolicy.json (2 hunks)
  • docs/source/_static/managed-policies/SageMakerStudioProjectRoleMachineLearningPolicy.json (3 hunks)
  • docs/source/_static/managed-policies/index.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/source/_static/managed-policies/index.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test cdk-iam-floyd
  • GitHub Check: Automerge CI
🔇 Additional comments (5)
docs/source/_static/managed-policies/AmazonEKSServiceRolePolicy.json (1)

257-271: New EC2 Action Statement for EKS Resources

A new statement is added that allows the actions "ec2:DeleteLaunchTemplate" and "ec2:TerminateInstances" on all resources with a condition that restricts execution to when "ec2:ManagedResourceOperator" equals "eks.amazonaws.com". This aligns with the goal of ensuring that only resources managed by EKS are affected.

Please verify that using an array for the condition value is intentional and that it remains consistent with other similar policy definitions.

docs/source/_static/managed-policies/SageMakerStudioEMRServiceRolePolicy.json (1)

25-41: New Statement: CreateInNetworkForSharedSubnet

A new statement (with Sid: "CreateInNetworkForSharedSubnet") has been introduced to allow the actions "ec2:CreateNetworkInterface", "ec2:RunInstances", and "ec2:CreateFleet" on all resources. It applies a condition using ArnLike to scope permitted actions to a specific VPC (determined via ${aws:PrincipalTag/VpcId}). Please confirm that the use of ArnLike is consistent with your VPC naming conventions and that this permission does not inadvertently broaden the allowed scope.

docs/source/_static/managed-policies/SageMakerStudioEMRInstanceRolePolicy.json (1)

1-133: New Policy File: SageMakerStudioEMRInstanceRolePolicy

This new policy file defines the permissions required for the SageMaker Studio EMR Instance Role. It includes detailed statements for:

• Accessing certificate locations in S3 with conditions enforcing non‐empty principal tags.
• Permissions for retrieving environment blueprints and bootstrap action scripts from S3.
• Log upload permissions and KMS operations for EBS encryption.

Each statement uses conditions to limit access based on ${aws:PrincipalTag/...} values and ensures that the actions are only allowed when the ${aws:PrincipalAccount} matches the resource account.

Overall, the file is comprehensive. Please verify that all conditions (especially around principal tags) exactly match your security design.

docs/source/_static/managed-policies/SageMakerStudioProjectRoleMachineLearningPolicy.json (2)

32-36: Refined Allocation of EC2 Network Interface Actions

Within the Sid: "AllowManageSageMakerTrainingEniOnVpc" block, the actions

  • "ec2:CreateNetworkInterface",
  • "ec2:DeleteNetworkInterface", and
  • "ec2:AttachNetworkInterface"
    are now included. These actions were shifted from another statement to better separate training-related ENI operations. Ensure that this separation correctly reflects the intended permission boundaries between training ENIs versus other network interfaces.

406-419: New SageMaker Search Permissions

A new permissions block (Sid: "SageMakerSearchPermissions") adds the action "sagemaker:Search" on all resources under the condition that the principal’s tag "EnableSageMakerMLWorkloadsPermissions" is set to "true". Additionally, a condition on
"sagemaker:SearchVisibilityCondition/Tags.AmazonDataZoneProject/EqualsIfExists"
is applied to further restrict search visibility based on the "AmazonDataZoneProject" tag value.

Please confirm that the chosen condition keys and their expected behavior exactly match your intended use case for enabling search functionality within SageMaker.

@udondan udondan merged commit 86c88c5 into main Feb 27, 2025
9 checks passed
@udondan udondan deleted the update-aws-managed-policies branch February 27, 2025 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant