creating-secrets-using-best-practices

Creates AWS Secrets Manager secrets with KMS encryption, rotation, and least-privilege IAM policies.

Updated Sep 8, 2026
One-click install
npx skills add https://github.com/dennisvink/yolomancer --skill creating-secrets-using-best-practices-dennisvink
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: creating-secrets-using-best-practices
Source: https://github.com/dennisvink/yolomancer/tree/main/skills/aws/specialized-skills/security-and-identity-skills/creating-secrets-using-best-practices
Command: npx skills add https://github.com/dennisvink/yolomancer --skill creating-secrets-using-best-practices-dennisvink

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Manually creating secrets in AWS Secrets Manager often skips critical security controls like dedicated KMS encryption, automatic rotation, and least-privilege access, leaving credentials exposed. This Skill walks through a complete procedure that applies production-grade security controls to every secret you create. ## Core Features & Use Cases - Secure Secret Creation: Creates database credentials, API keys, OAuth tokens, and custom secrets encrypted with a dedicated KMS key whose policy is scoped to Secrets Manager via the kms:ViaService condition. - Automatic Rotation: Configures rotation intervals, AWS-managed rotation for database secrets, and custom Lambda rotation functions with an initial test rotation. - Least-Privilege Access & Auditing: Generates scoped IAM policies with aws:SecureTransport enforcement, verifies CloudTrail logging, and sets up CloudWatch alarms for failed retrievals and rotation failures. - Use Case: You need to store production database credentials for a new application. Provide the secret name, type, value, and region, and the Skill provisions the KMS key, secret, rotation schedule, IAM policy, and monitoring alarms in one guided workflow. ## Quick Start Create a new database secret named prod-database-credentials in us-east-1 with automatic 30-day rotation and least-privilege access following security best practices.

Frequently Asked Questions about creating-secrets-using-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a secret in AWS Secrets Manager with automatic rotation?

Provide the secret name, type, value, and region, then set enable_rotation to true with a rotation interval in days. Database secrets use AWS-managed rotation functions, while custom secrets require a Lambda function ARN with permissions to access both the secret and target system.

What secret types does AWS Secrets Manager support in this procedure?

Four secret types are supported: database, api-key, oauth, and custom. Database secrets are structured as JSON with host, username, password, engine, port, and dbname, while API keys and OAuth tokens use their own JSON structures.

How do I encrypt AWS secrets with a dedicated KMS key?

If no KMS key ID is provided, a new key is created with a policy granting kms:GenerateDataKey, kms:Decrypt, and kms:DescribeKey scoped via the kms:ViaService condition to secretsmanager in your region. Key rotation is enabled and the root account is retained as administrator.

Why does secret access get denied after creation in Secrets Manager?

Access denied errors usually mean the IAM policy is not attached to the correct principal, the KMS key policy does not allow decryption, or the request is not using HTTPS. Verify the aws:SecureTransport condition and that the key policy grants kms:Decrypt to the principal.

Why does Secrets Manager rotation setup fail?

Rotation fails when the Lambda function is missing, lacks permissions to access the secret or target system, or cannot reach the target over the network. Check CloudWatch logs for the rotation function and verify its execution role permissions.