Skip to content

Secrets Manager

CloudMock emulates AWS Secrets Manager, providing secret lifecycle management including creation, retrieval, versioning, deletion with restore capability, and tagging.

OperationStatusNotes
CreateSecretSupportedCreates a secret with string or binary value
GetSecretValueSupportedReturns the current secret value
PutSecretValueSupportedAdds a new version of the secret
UpdateSecretSupportedUpdates secret metadata (description, KMS key)
DeleteSecretSupportedMarks the secret for deletion (immediate in emulator)
RestoreSecretSupportedCancels a pending deletion
DescribeSecretSupportedReturns secret metadata without the value
ListSecretsSupportedReturns all secrets
TagResourceSupportedAdds tags to a secret
UntagResourceSupportedRemoves tags from a secret
Terminal window
# Create a secret
curl -X POST http://localhost:4566 \
-H "X-Amz-Target: secretsmanager.CreateSecret" \
-H "Content-Type: application/x-amz-json-1.1" \
-d '{"Name": "/app/db-password", "SecretString": "supersecret"}'
# Get secret value
curl -X POST http://localhost:4566 \
-H "X-Amz-Target: secretsmanager.GetSecretValue" \
-H "Content-Type: application/x-amz-json-1.1" \
-d '{"SecretId": "/app/db-password"}'
import { SecretsManagerClient, CreateSecretCommand, GetSecretValueCommand } from '@aws-sdk/client-secrets-manager';
const sm = new SecretsManagerClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
await sm.send(new CreateSecretCommand({
Name: '/app/db-password', SecretString: 'supersecret',
}));
const { SecretString } = await sm.send(new GetSecretValueCommand({
SecretId: '/app/db-password',
}));
console.log(SecretString); // supersecret
import boto3, json
sm = boto3.client('secretsmanager', endpoint_url='http://localhost:4566',
aws_access_key_id='test', aws_secret_access_key='test',
region_name='us-east-1')
sm.create_secret(
Name='/app/config',
SecretString=json.dumps({'host': 'db.local', 'password': 's3cr3t'}),
)
response = sm.get_secret_value(SecretId='/app/config')
config = json.loads(response['SecretString'])
print(config['host']) # db.local
cloudmock.yml
services:
secretsmanager:
enabled: true

No additional service-specific configuration is required.

  • Secret versioning is tracked via version IDs but only the latest version is accessible without specifying a version ID.
  • Automatic rotation is not implemented.
  • Binary secrets (SecretBinary) are stored but returned as-is without base64 processing.
  • Resource policies on secrets are not supported.
  • Replication to other regions is not implemented.
CodeHTTP StatusDescription
ResourceNotFoundException400The specified secret does not exist
ResourceExistsException400A secret with this name already exists
InvalidParameterException400An input parameter is invalid
InvalidRequestException400The request is not valid (e.g., deleting an already-deleted secret)