| Server IP : 138.197.107.151 / Your IP : 216.73.216.170 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/bsd-crawler-parser/aws/dist/awscli/examples/iam/ |
Upload File : |
**Example 1: To simulate the effects of an arbitrary IAM policy**
The following ``simulate-principal-policy`` shows how to simulate a user calling an API action and determining whether the policies associated with that user allow or deny the action. In the following example, the user has a policy that allows only the ``codecommit:ListRepositories`` action. ::
aws iam simulate-principal-policy \
--policy-source-arn arn:aws:iam::123456789012:user/alejandro \
--action-names codecommit:ListRepositories
Output::
{
"EvaluationResults": [
{
"EvalActionName": "codecommit:ListRepositories",
"EvalResourceName": "*",
"EvalDecision": "allowed",
"MatchedStatements": [
{
"SourcePolicyId": "Grant-Access-To-CodeCommit-ListRepo",
"StartPosition": {
"Line": 3,
"Column": 19
},
"EndPosition": {
"Line": 9,
"Column": 10
}
}
],
"MissingContextValues": []
}
]
}
**Example 2: To simulate the effects of a prohibited command**
The following ``simulate-custom-policy`` example shows the results of simulating a command that is prohibited by one of the user's policies. In the following example, the user has a policy that permits access to a DynamoDB database only after a certain date and time. The simulation has the user attempting to access the database with an ``aws:CurrentTime`` value that is earlier than the policy's condition permits. ::
aws iam simulate-principal-policy \
--policy-source-arn arn:aws:iam::123456789012:user/alejandro \
--action-names dynamodb:CreateBackup \
--context-entries "ContextKeyName='aws:CurrentTime',ContextKeyValues='2018-04-25T11:00:00Z',ContextKeyType=date"
Output::
{
"EvaluationResults": [
{
"EvalActionName": "dynamodb:CreateBackup",
"EvalResourceName": "*",
"EvalDecision": "implicitDeny",
"MatchedStatements": [],
"MissingContextValues": []
}
]
}
For more information, see `Testing IAM policies with the IAM policy simulator <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html>`__ in the *AWS IAM User Guide*.