Security and compliance policies are the written rules that bind an operator's actions to the organization's risk tolerance. In practical terms, an operator translates those rules into AWS controls: identity policies that constrain what principals may do, resource policies that constrain who may touch a given asset, encryption controls that constrain how data is stored and moved, and continuous monitoring controls that catch drift. The CloudOps role is rarely the author of the top-level policy. The CloudOps role is the engineer who turns the policy into measurable AWS configuration and proves, on an ongoing basis, that the configuration holds.
The first decision in any policy implementation is choosing the right control layer. AWS provides four layers stacked from broadest to narrowest: AWS Organizations service control policies (SCPs) set guardrails for entire accounts; permission boundaries cap the maximum permissions for an IAM principal; identity-based IAM policies grant permissions to users, groups, and roles; and resource-based policies attached to resources (S3 bucket policies, KMS key policies, Lambda function policies) decide which principals may touch that specific resource. A request is allowed only if every applicable layer says yes, with one exception: SCPs never grant permissions, they only deny. An operator who reaches for "add an allow statement" to fix an SCP-blocked action has misunderstood the layer stack and will compound the misconfiguration. Effective policies use SCPs as the wall, permission boundaries as the safety cage for developer-created roles, identity policies for day-to-day grants, and resource policies for cross-account sharing and resource isolation.
A second decision is the lifecycle: who issues, rotates, and retires the credentials and the resources tied to the policy. Static IAM users with long-lived access keys are the failure mode the exam returns to repeatedly. The current pattern is short-lived credentials sourced through federation (IAM Identity Center, SAML, or OIDC) and IAM roles assumed via sts:AssumeRole. When an application running on EC2 needs AWS access, it uses an instance profile that maps to an IAM role; when a workload runs on ECS or EKS, it uses a task role or IRSA/Pod Identity; when a Lambda function needs access, it uses the function's execution role. None of these require a stored access key, none require rotation, and all surface in CloudTrail with the role identity in the userIdentity block.
A third decision concerns what counts as a secret. An access key is a secret, but so are database connection strings, OAuth client secrets, third-party API keys, license codes, and signing certificates the workload uses to call partners. Storing any of these in plaintext environment variables, AMIs, container images, source code, or CloudFormation parameters (without NoEcho) creates a permanent leak. The AWS pattern is to keep the secret in either AWS Secrets Manager or AWS Systems Manager Parameter Store SecureString and pull it at runtime through an IAM-authorized API call. Secrets Manager is the choice when the secret needs automatic rotation, cross-Region replication, or fine-grained resource policies. Parameter Store SecureString is the choice when the parameter is read-mostly configuration, is shared with many runtimes, and the cost of per-API charges matters.
The fourth decision is auditability. Every policy change, every secret retrieval, every key use must be answerable to "who did what, when, from where, on which resource". CloudTrail management events capture the policy and secret control plane; data events capture per-secret reads when configured. AWS Config records the policy state itself: who attached the policy, when, and what its content was at a point in time. A policy framework that lacks a working CloudTrail trail and an AWS Config recorder in every Region is structurally not auditable, regardless of how strict the policies themselves are.
The fifth decision is integration with the rest of the platform. Operators should keep policies in version-controlled infrastructure as code, evaluate them with the IAM policy simulator before deployment, deploy them through AWS CloudFormation or AWS CDK, drift-detect them with AWS Config, and remediate drift through Systems Manager Automation runbooks. A policy that exists only in the AWS Management Console is invisible to the rest of the operations stack.
💡 Exam Trap: An SCP that denies
s3:DeleteBucketdoes NOT grants3:DeleteBucket. To allow a principal to delete a bucket, the principal still needs an identity policy that allows the action; the SCP only widens or narrows the ceiling. Questions that test "the SCP is in place but the user cannot perform the action" almost always have a missing identity-policyAllow, not a missing SCPAllow.
⚠️ Anti-Pattern: Storing a database password as a plaintext
Defaultvalue in an AWS CloudFormation template parameter. The parameter value appears inDescribeStacksoutput, in change-set diffs, and in CloudTrail events for any operator withcloudformation:DescribeStacks. The fix is to mark the parameterNoEcho: trueand source the value from AWS Secrets Manager ({{resolve:secretsmanager:MySecret:SecretString:password}}) or AWS Systems Manager Parameter Store ({{resolve:ssm-secure:/db/password:1}}).
Storing secrets with AWS Secrets Manager
AWS Secrets Manager is a managed secret store with built-in encryption (AWS KMS), per-secret resource policies, automatic versioning, cross-Region replication, and Lambda-based rotation. Secrets are retrieved by name or ARN through secretsmanager:GetSecretValue, and every retrieval is recorded in CloudTrail. Each secret has versions identified by VersionId (a UUID) and VersionStages (a set of labels). The well-known stages are AWSCURRENT (the version the application reads by default), AWSPENDING (a candidate version under rotation), and AWSPREVIOUS (the version stage demoted after a successful rotation).
Rotation is configured per secret and runs through a Lambda function. AWS publishes managed rotation Lambdas for Amazon RDS engines (MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, Aurora), Amazon DocumentDB, and Amazon Redshift. For other secrets, the operator writes a custom rotation Lambda with four steps: createSecret (generate the new value and store it as AWSPENDING), setSecret (write the new value into the target system such as a database user), testSecret (verify the new credential works), and finishSecret (move the AWSCURRENT stage label to the new version and AWSPREVIOUS to the old one). The Lambda function must have permission to read and update the secret, and the secret's resource policy must allow the Lambda's execution role.
A safe rotation window has three properties: it runs frequently enough to limit blast radius, it never causes an authentication outage, and it never leaves a half-rotated state. The two-user rotation pattern for databases is the operational baseline: the rotation Lambda alternates between two database users (a "blue" and a "green" credential), updating the inactive one each cycle. The active user is never modified mid-cycle, so an in-flight database connection cannot fail because its password changed underneath it.
# Create a secret containing a JSON document with username and password.
aws secretsmanager create-secret \
--name /prod/rds/app-db \
--description "Application database credentials for prod" \
--secret-string '{"username":"app_user","password":"placeholder"}' \
--kms-key-id alias/aws-secrets-prod \
--tags Key=Environment,Value=prod Key=Owner,Value=platform-team
# Attach a rotation schedule with the AWS-managed RDS PostgreSQL single-user
# rotation Lambda, rotated every 14 days.
aws secretsmanager rotate-secret \
--secret-id /prod/rds/app-db \
--rotation-lambda-arn arn:aws:lambda:us-east-1:111122223333:function:SecretsManagerRDSPostgreSQLRotationSingleUser \
--rotation-rules '{"AutomaticallyAfterDays":14}'
# Retrieve the current secret value from an application or runbook.
aws secretsmanager get-secret-value \
--secret-id /prod/rds/app-db \
--version-stage AWSCURRENT \
--query SecretString \
--output text
The matching resource policy for a secret consumed by only one application is the principle of least privilege made concrete: name the exact role that may read the secret, and deny everything else.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAppRoleRead",
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111122223333:role/app-task-role" },
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
},
{
"Sid": "DenyEveryoneElse",
"Effect": "Deny",
"NotPrincipal": {
"AWS": [
"arn:aws:iam::111122223333:role/app-task-role",
"arn:aws:iam::111122223333:role/SecretsRotationRole"
]
},
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
}
]
}
Storing secrets with AWS Systems Manager Parameter Store SecureString
Parameter Store has three parameter types: String, StringList, and SecureString. Only SecureString is encrypted at rest with AWS KMS. A SecureString parameter is decrypted by callers who add --with-decryption (CLI) or WithDecryption=true (SDK) AND who have kms:Decrypt on the KMS key that wrapped the parameter, in addition to ssm:GetParameter. The most common operator mistake is granting ssm:GetParameter without also granting kms:Decrypt on the encryption key; the call returns AccessDenied with a KMS error nested in the response, not an SSM error.
Parameter Store does NOT auto-rotate. Rotation, if needed, is a workflow the operator writes (an EventBridge schedule that invokes a Lambda that updates the parameter and pushes the new value into the consuming workload). For most teams, the choice between the two services is clear: store a value in Secrets Manager when rotation, replication, and per-secret resource policies matter; store a value in Parameter Store SecureString when the value is configuration with secret material (an OAuth client secret read by a fleet of EC2 instances at boot), cost matters, and rotation can be handled out of band.
Advanced parameter tier (--tier Advanced) raises the maximum size from 4 KB to 8 KB and unlocks parameter policies, including Expiration (the parameter is deleted after a timestamp), ExpirationNotification (an EventBridge event fires before expiration), and NoChangeNotification (an event fires if the parameter has not been updated within a window). Parameter policies are the closest Parameter Store gets to lifecycle automation.
# Store a third-party API key as a SecureString using a customer-managed KMS key.
aws ssm put-parameter \
--name /prod/integrations/stripe-api-key \
--value "sk_live_<sample-value-redacted-in-docs>" \
--type SecureString \
--key-id alias/aws-ssm-prod \
--tier Advanced \
--policies '[{"Type":"Expiration","Version":"1.0","Attributes":{"Timestamp":"2099-01-01T00:00:00Z"}},{"Type":"NoChangeNotification","Version":"1.0","Attributes":{"After":"90","Unit":"Days"}}]' \
--overwrite
# Read the decrypted value (requires ssm:GetParameter + kms:Decrypt on the key).
aws ssm get-parameter \
--name /prod/integrations/stripe-api-key \
--with-decryption \
--query Parameter.Value \
--output text
📊 Limit: A Parameter Store standard parameter is up to 4 KB. An Advanced parameter is up to 8 KB. A Secrets Manager secret value (the
SecretStringplusSecretBinary) is up to 64 KB. Choose the right service before storing a large blob; if the value is bigger than 64 KB, the value is probably a config file or certificate bundle that belongs in S3 with SSE-KMS, not in a secret store.
🎯 Scenario: An application running on Amazon ECS Fargate fails to start with
AccessDeniedExceptionwhen it callsGetParameteron/prod/db/password(a SecureString). The task role policy grantsssm:GetParameteron the parameter ARN. CloudTrail shows the call reached SSM and was denied by KMS. The fix is to addkms:Decrypton the customer-managed KMS key that wrapped the parameter (or to grant the task role principal access in the key's key policy). The SSM permission alone is never enough for a SecureString.
💡 Exam Trap: Secrets Manager rotation Lambdas need permissions on BOTH the secret AND the target system. A common rotation failure shows
AWSPENDINGset but never promoted toAWSCURRENT; the cause is usually that the Lambda could update the password in Secrets Manager but lacked database privileges (or network reachability through a security group) to set the new password on the database itself. Trace the rotation Lambda's CloudWatch Logs for the exact step that failed; the four-step contract (createSecret,setSecret,testSecret,finishSecret) localizes the failure.
⚠️ Anti-Pattern: Using Parameter Store as a "free" Secrets Manager by writing a custom EventBridge-scheduled rotation Lambda for production database passwords. The rotation works in steady state, but the implementation must reinvent versioning, staged promotion, and rollback, the three things Secrets Manager provides natively. The operational cost over time exceeds Secrets Manager's per-secret monthly fee. Choose Parameter Store SecureString for static configuration and Secrets Manager for credentials that need lifecycle.
Decision Anchor: Choose AWS Secrets Manager when the value is a credential needing automatic rotation, multi-Region replication, or a per-secret resource policy. Choose AWS Systems Manager Parameter Store SecureString when the value is read-mostly configuration with secret material, cost per parameter matters, and rotation either is not needed or is handled out of band.
