Skip to content

IAM

CloudMock emulates AWS IAM as an embedded engine within the gateway, managing users, access keys, and policies with full policy evaluation when running in enforce mode.

OperationStatusNotes
CreateUserSupportedCreates an IAM user (via seed file or admin API)
GetUserSupportedReturns user details
CreateAccessKeySupportedCreates an access key pair for a user
AttachUserPolicySupportedAttaches a policy to a user
GetUserPoliciesSupportedReturns policies attached to a user
Terminal window
# Check caller identity (uses root credentials by default)
curl -X POST "http://localhost:4566/?Action=GetCallerIdentity&Version=2011-06-15" \
-H "Authorization: AWS4-HMAC-SHA256 Credential=test/20260101/us-east-1/sts/aws4_request"
import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
const sts = new STSClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
const identity = await sts.send(new GetCallerIdentityCommand({}));
console.log(identity.Arn); // arn:aws:iam::000000000000:root
import boto3
sts = boto3.client('sts', endpoint_url='http://localhost:4566',
aws_access_key_id='test', aws_secret_access_key='test',
region_name='us-east-1')
identity = sts.get_caller_identity()
print(identity['Arn']) # arn:aws:iam::000000000000:root
cloudmock.yml
iam:
mode: enforce # none | authenticate | enforce
seed_file: ./iam-seed.json
root_access_key: test
root_secret_key: test
ModeBehavior
noneSkip all authentication and authorization
authenticateVerify credentials exist, skip policy evaluation
enforceFull policy evaluation on every request

Bulk-load users, access keys, and policies at startup:

{
"users": [
{
"name": "ci",
"access_key_id": "AKIAIOSFODNN7EXAMPLE",
"secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"policies": [
{
"name": "AllowAll",
"document": {
"Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow", "Action": "*", "Resource": "*" }
]
}
}
]
}
]
}
  • IAM is embedded in the gateway, not exposed as a standalone HTTP service.
  • The root user (root_access_key credential) bypasses all policy checks.
  • Roles, groups, and instance profiles are not implemented.
  • Managed policies (AWS-managed policy ARNs) are not available.
  • Policy conditions (Condition block) are not evaluated.
  • Wildcard matching supports * in Action and Resource fields.
CodeHTTP StatusDescription
AccessDenied403The request was denied by policy evaluation
InvalidClientTokenId403The access key ID does not exist
SignatureDoesNotMatch403The secret key does not match
IncompleteSignature400The request signature is incomplete