AWS agent-toolkit documentation change
Summary
Replaced general IAM policy best practices and examples with MCP-specific policy examples using condition keys to control access via AWS MCP Server. Added three new policy examples: denying all actions through MCP servers, denying destructive actions through MCP, and restricting access to specific MCP servers.
Security assessment
The changes add documentation for security-focused IAM policies using MCP condition keys (aws:ViaAWSMCPService and aws:CalledViaAWSMCP) to control access through AWS MCP Server. This demonstrates security features for restricting agent permissions but doesn't address any specific vulnerability. The examples show how to implement least-privilege access for AI agents.
Diff
diff --git a/agent-toolkit/latest/userguide/security_iam_id-based-policy-examples.md b/agent-toolkit/latest/userguide/security_iam_id-based-policy-examples.md index 55d40ea9a..ce4a0e4ad 100644 --- a//agent-toolkit/latest/userguide/security_iam_id-based-policy-examples.md +++ b//agent-toolkit/latest/userguide/security_iam_id-based-policy-examples.md @@ -7 +7 @@ -Policy best practicesUsing the consoleAllow users to view their own permissions +Deny all actions through any AWS managed MCP serverDeny destructive actions through AWS MCP ServerRestrict actions to a specific MCP server @@ -11,5 +11 @@ Policy best practicesUsing the consoleAllow users to view their own permissions -By default, users and roles don't have permission to create or modify Agent Toolkit for AWS resources. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. - -To learn how to create an IAM identity-based policy by using these example JSON policy documents, see [Create IAM policies (console)](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create-console.html) in the _IAM User Guide_. - -For details about actions and resource types defined by Agent Toolkit for AWS, including the format of the ARNs for each of the resource types, see [Actions, Resources, and Condition Keys for Agent Toolkit for AWS](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_your_service.html) in the _Service Authorization Reference_. +The following examples show how to use IAM policies with the MCP condition context keys to control access through AWS MCP Server. Each example shows the policy statement to include within your IAM policy document. @@ -19,10 +15 @@ For details about actions and resource types defined by Agent Toolkit for AWS, i - * Policy best practices - - * Using the AWS MCP Server console - - * Allow users to view their own permissions - - - - -## Policy best practices + * Deny all actions through any AWS managed MCP server @@ -30 +17 @@ For details about actions and resource types defined by Agent Toolkit for AWS, i -Identity-based policies determine whether someone can create, access, or delete Agent Toolkit for AWS resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations: + * Deny destructive actions through AWS MCP Server @@ -32 +19 @@ Identity-based policies determine whether someone can create, access, or delete - * **Get started with AWS managed policies and move toward least-privilege permissions** – To get started granting permissions to your users and workloads, use the _AWS managed policies_ that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see [AWS managed policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies) or [AWS managed policies for job functions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html) in the _IAM User Guide_. + * Restrict actions to a specific MCP server @@ -34 +20,0 @@ Identity-based policies determine whether someone can create, access, or delete - * **Apply least-privilege permissions** – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as _least-privilege permissions_. For more information about using IAM to apply permissions, see [ Policies and permissions in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) in the _IAM User Guide_. @@ -36 +21,0 @@ Identity-based policies determine whether someone can create, access, or delete - * **Use conditions in IAM policies to further restrict access** – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as CloudFormation. For more information, see [ IAM JSON policy elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the _IAM User Guide_. @@ -38 +22,0 @@ Identity-based policies determine whether someone can create, access, or delete - * **Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions** – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see [Validate policies with IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-validation.html) in the _IAM User Guide_. @@ -40 +24 @@ Identity-based policies determine whether someone can create, access, or delete - * **Require multi-factor authentication (MFA)** – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see [ Secure API access with MFA](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html) in the _IAM User Guide_. +## Deny all actions through any AWS managed MCP server @@ -41,0 +26 @@ Identity-based policies determine whether someone can create, access, or delete +The following SCP or IAM policy denies all actions when the request originates from any AWS managed MCP server. Use this to completely block MCP server access across an organization or for specific principals. @@ -43,0 +29,11 @@ Identity-based policies determine whether someone can create, access, or delete + { + "Sid": "DenyAllActionsViaMCP", + "Effect": "Deny", + "Action": "*", + "Resource": "*", + "Condition": { + "Bool": { + "aws:ViaAWSMCPService": "true" + } + } + } @@ -45,11 +41 @@ Identity-based policies determine whether someone can create, access, or delete -For more information about best practices in IAM, see [Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) in the _IAM User Guide_. - -## Using the AWS MCP Server console - -To access the Agent Toolkit for AWS console, you must have a minimum set of permissions. These permissions must allow you to list and view details about the Agent Toolkit for AWS resources in your AWS account. If you create an identity-based policy that is more restrictive than the minimum required permissions, the console won't function as intended for entities (users or roles) with that policy. - -You don't need to allow minimum console permissions for users that are making calls only to the AWS CLI or the AWS API. Instead, allow access to only the actions that match the API operation that they're trying to perform. - -To ensure that users and roles can still use the AWS MCP Server console, also attach the AWS MCP Server ``ConsoleAccess`` or ``ReadOnly`` AWS managed policy to the entities. For more information, see [Adding permissions to a user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_change-permissions.html#users_change_permissions-add-console) in the _IAM User Guide_. - -## Allow users to view their own permissions +## Deny destructive actions through AWS MCP Server @@ -57 +43 @@ To ensure that users and roles can still use the AWS MCP Server console, also at -This example shows how you might create a policy that allows IAM users to view the inline and managed policies that are attached to their user identity. This policy includes permissions to complete this action on the console or programmatically using the AWS CLI or AWS API. +The following policy allows read operations but denies destructive actions when the request comes through AWS MCP Server. This lets AI agents inspect resources without being able to delete them. @@ -59,0 +46 @@ This example shows how you might create a policy that allows IAM users to view t + [ @@ -61,4 +48 @@ This example shows how you might create a policy that allows IAM users to view t - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "ViewOwnUserInfo", + "Sid": "AllowS3ReadOperations", @@ -67,5 +51,2 @@ This example shows how you might create a policy that allows IAM users to view t - "iam:GetUserPolicy", - "iam:ListGroupsForUser", - "iam:ListAttachedUserPolicies", - "iam:ListUserPolicies", - "iam:GetUser" + "s3:GetObject", + "s3:ListBucket" @@ -73 +54 @@ This example shows how you might create a policy that allows IAM users to view t - "Resource": ["arn:aws:iam::*:user/${aws:username}"] + "Resource": "*" @@ -76,2 +57,2 @@ This example shows how you might create a policy that allows IAM users to view t - "Sid": "NavigateInConsole", - "Effect": "Allow", + "Sid": "DenyDeleteWhenAccessedViaMCP", + "Effect": "Deny", @@ -79,8 +60,2 @@ This example shows how you might create a policy that allows IAM users to view t - "iam:GetGroupPolicy", - "iam:GetPolicyVersion", - "iam:GetPolicy", - "iam:ListAttachedGroupPolicies", - "iam:ListGroupPolicies", - "iam:ListPolicyVersions", - "iam:ListPolicies", - "iam:ListUsers" + "s3:DeleteObject", + "s3:DeleteBucket" @@ -88 +63,6 @@ This example shows how you might create a policy that allows IAM users to view t - "Resource": "*" + "Resource": "*", + "Condition": { + "StringEquals": { + "aws:CalledViaAWSMCP": "aws-mcp.amazonaws.com" + } + } @@ -90,0 +71,16 @@ This example shows how you might create a policy that allows IAM users to view t + +## Restrict actions to a specific MCP server + +The following policy denies all actions when the request comes specifically through AWS MCP Server, while allowing requests from other AWS managed MCP servers or direct API calls. + + + { + "Sid": "DenyActionsViaAWSMCPServer", + "Effect": "Deny", + "Action": "*", + "Resource": "*", + "Condition": { + "StringEquals": { + "aws:CalledViaAWSMCP": "aws-mcp.amazonaws.com" + } + } @@ -101 +97 @@ How AWS MCP Server works with IAM -AWS managed policies +Troubleshooting