Keys, secrets, and masking
SCS-C03 · Lesson 19 of 22 · 2:49:42
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the SCS-C03 exam (AWS Certified Security – Specialty). In this lesson: AWS Secrets Manager rotation, cross-account sharing, and replication, KMS key material (generated by AWS KMS, imported with an expiration time, or held in an external key store), CloudWatch Logs data protection policies and logs:Unmask, and keys and certificates across Regions with multi-Region keys and AWS Private CA. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
A password in a file
A database password sits in a configuration file, a key that nobody can rotate protects years of data, and a log line shows a patient's insurance number. At AnyCompany Health, secrets must change on their own, keys must follow strict rules, and sensitive data must never appear in clear text in the logs. This lesson covers secrets, key material, masking, and keys and certificates across Regions.
Secrets and rotation
AWS Secrets Manager stores secrets such as database passwords and API keys, so that applications fetch them at run time instead of keeping them in code or in configuration files. Rotation changes a secret on a schedule, as often as every four hours, either with managed rotation, where the service rotates it without a Lambda function, or with a Lambda function that you provide. With the single user strategy, there is a short moment when the old password no longer works, so the application must retry, while the alternating users strategy uses two users, created with a superuser secret, so that one of them always works and the database stays available. To share a secret with another account, allow it in both the resource policy of the secret and an identity policy in that account, and encrypt the secret with a customer managed key, because the AWS managed key for Secrets Manager cannot be used across accounts. And replica secrets copy a secret to other Regions, with the same encrypted value, and a replica can be promoted to a standalone secret.
Key material
By default, the key material of a KMS key is generated by AWS KMS, and for symmetric keys of that kind, automatic rotation creates new key material every year by default, or on a period that you choose, while the older material still decrypts old data. AWS managed keys rotate every year too, and you cannot change that, while asymmetric keys, HMAC keys, and keys in custom key stores cannot rotate automatically, so you rotate them by hand: create a new key, and point the alias to it. With imported key material, you create the material in your own HSM and import it into KMS, so you stay responsible for keeping a copy, and you can set an expiration time, after which the key stops working until you import the same material again. An external key store goes further: the keys stay in an external key manager that you own, outside AWS, and KMS reaches them only through an external key store proxy, so data is encrypted twice, and neither AWS KMS nor the owner of the external key can decrypt it alone. That control has a cost: you are responsible for the availability, durability, and latency of the external keys, so external key stores are meant for workloads where rules require keys outside AWS.
Masking sensitive data
Logs often collect data that should never be there, such as names, insurance numbers, or card numbers, so CloudWatch Logs data protection policies find sensitive data and mask it as it is ingested. A policy can apply to one log group, or at the account level, to every existing and future log group, and it uses managed data identifiers for financial data, health information, and personal data, or custom identifiers for your own types of data. Masked data stays masked everywhere it goes out, in Logs Insights queries, metric filters, and subscription filters, and only principals with the logs:Unmask permission can see it in clear text. Amazon SNS also has message data protection, which can audit, mask, or block sensitive data in messages on standard topics, but it is no longer available to new customers. Remember that masking is not encryption: the data is still stored, so protect it with encryption and access control too, and keep it out of the logs whenever you can.
Keys and certificates across Regions
Multi-Region keys are KMS keys in different Regions with the same key ID and the same key material, so data encrypted in one Region can be decrypted in another without a call across Regions, which helps disaster recovery and global applications. They are not global keys: each multi-Region key is a separate resource, with its own key policy and its own aliases, that you manage in its Region. Choose a customer managed key when you need to control its key policy, its rotation, and its deletion, and keep AWS managed keys for services where the defaults are enough. For private certificates, AWS Private Certificate Authority creates root and subordinate CAs, and issues X.509 certificates for TLS inside your network, for authenticating users, computers, API endpoints, and IoT devices, and for code signing. Private CAs are Regional, so to issue certificates in more than one Region, create a CA in each of those Regions.
Recap
Let's recap. Secrets Manager rotates secrets with managed rotation or a Lambda function, shares them across accounts with a customer managed key, and copies them to other Regions. KMS key material is generated by AWS KMS, imported with an expiration time, or kept in an external key store that you run. CloudWatch Logs data protection policies mask sensitive data, and only logs:Unmask reveals it. And multi-Region keys and AWS Private CA give you keys and certificates in every Region that you use.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Key material for patient records must be created in the company's own HSM, with a copy kept outside AWS, and must stop working after one year unless it is imported again. Which KMS key should the team create?
- A KMS key with automatic yearly rotation
- An AWS managed key for the service
- A multi-Region key with a replica
- A key with imported, expiring material
Show the answer
A key with imported, expiring material
With imported key material, the team creates the material in its own HSM, keeps a copy, and sets an expiration time. “A KMS key with automatic yearly rotation” would use key material generated by AWS KMS, which never leaves KMS unencrypted. “An AWS managed key for the service” is created and managed by AWS, so the team controls neither its material nor its lifetime. And “A multi-Region key with a replica” is about using the same key in several Regions, and it says nothing about where the material comes from.
Application logs sometimes contain insurance numbers. The security team must still see them during an investigation, but nobody else may see them in clear text. What should the team configure?
- A metric filter that removes the numbers
- An SNS topic with message data protection
- A data protection policy that masks them
- Encryption of the log group with a KMS key
Show the answer
A data protection policy that masks them
A data protection policy masks the numbers as they are ingested, and only principals with the logs:Unmask permission, such as the security team, can see them. “A metric filter that removes the numbers” would only turn matching events into a metric, and the events would keep the numbers. “An SNS topic with message data protection” is for messages in SNS topics, not for log groups, and it is closed to new customers. And “Encryption of the log group with a KMS key” protects the logs at rest, but anyone who can open the log group and use the key still sees the numbers.
AnyCompany Health keeps a standby copy of its encrypted patient database in a second Region. If the first Region fails, the standby must decrypt without calling KMS in the first Region. What should the team use?
- One AWS managed key in each of the Regions
- A multi-Region key with a replica key
- A grant on the key for the standby role
- Automatic rotation on the primary key
Show the answer
A multi-Region key with a replica key
A replica key has the same key ID and the same key material, so the standby decrypts the data in its own Region. “One AWS managed key in each of the Regions” would give two unrelated keys, and data encrypted under one of them cannot be decrypted with the other. “A grant on the key for the standby role” would still call KMS in the first Region, where the key is. And “Automatic rotation on the primary key” changes the key material over time, but the key stays in one Region.