0%
AWS Solutions Architect Associate (SAA-C03) Exam Prep: Secure, Resilient, High-Performing and Cost-Optimized Architectures
Domain 2: Design Resilient Architectures
Domain 3: Design High-Performing Architectures
Domain 4: Design Cost-Optimized Architectures
Final Review and Mock Exams
Protecting Data: Encryption, Keys and Secrets
Data protection is a large part of the secure architectures domain. Questions ask how to encrypt data at rest and in transit, who controls the keys, how to share encrypted data across accounts, how to store and rotate secrets and how to stop data in S3 from being exposed or deleted. Almost all of it rests on one service, AWS Key Management Service, so this lesson starts there.
At rest and in transit
Encryption at rest protects stored data: objects in S3, blocks on EBS volumes, database storage, snapshots and backups. Someone who obtains the underlying storage cannot read it without the key. Encryption in transit protects data moving over a network, using TLS between clients and services and between services. The exam expects both, and an option that encrypts storage but leaves a connection in plain HTTP rarely satisfies a requirement for end to end protection.
With AWS services, encryption at rest is almost always a setting rather than something you build. You choose to enable it, or it is on by default, and you choose which key protects the data. The decision that matters on the exam is therefore usually about the key: who owns it, who can use it, whether its use is logged and whether it can be shared.
What AWS KMS is
AWS KMS creates and manages cryptographic keys and performs operations with them. Keys are stored in hardware security modules that AWS operates, and the key material of a KMS key never leaves KMS unencrypted. Applications and AWS services call KMS APIs such as Encrypt, Decrypt and GenerateDataKey, and every call is authorised by policies and recorded in AWS CloudTrail. That audit trail is one of the main reasons to choose KMS keys: you can see who used which key, when and from which service.
KMS keys are regional. A key in one Region cannot be used in another, so data encrypted in one Region and copied to another must be re-encrypted with a key in the destination Region. Services that copy snapshots or replicate data across Regions handle this when you choose a destination key. Multi-Region keys, described later, are the exception for applications that encrypt client side and need the same key in several Regions.
Types of KMS keys
AWS owned keys belong to a service and are used across many customers' accounts. You cannot see, manage or audit them, but they cost nothing and need no setup. Several services use them by default, for example DynamoDB tables and SQS queues when you choose the default encryption.
AWS managed keys are created in your account by a service on your behalf, with aliases such as aws/s3, aws/ebs and aws/rds. You can see them and their use is logged in CloudTrail, but you cannot change their key policies, and they are rotated automatically every year. Because you cannot edit their key policies, you cannot grant another account permission to use them, which matters for cross-account sharing.
Customer managed keys are created and controlled by you. You write the key policy, can enable or disable the key, choose automatic rotation and its period, rotate on demand, schedule deletion and grant access to other accounts. They have a monthly charge per key plus charges per request. When a question asks for control over who can use a key, for separate keys per application or data set, for cross-account access to encrypted data or for the ability to disable access to data immediately, a customer managed key is the answer.
Envelope encryption
A KMS key can directly encrypt only small amounts of data, up to 4 KB, and every call goes over the network to KMS. Encrypting large data that way would be slow and expensive. Instead, AWS services and the AWS Encryption SDK use envelope encryption. The application calls GenerateDataKey, and KMS returns a fresh data key in two forms: plaintext and encrypted under the KMS key. The application encrypts its data locally with the plaintext data key, discards the plaintext key from memory and stores the encrypted data key alongside the ciphertext.
To decrypt, the application sends the encrypted data key to KMS, which decrypts it with the KMS key if the caller is allowed, and the application then decrypts the data locally. The KMS key itself never leaves KMS, each object or volume can have its own data key, and access to all of them is controlled by the one KMS key's policy. Disabling the KMS key makes every data key it protects unusable, which is how a customer managed key gives you a way to cut off access to large amounts of data at once.
Rotation and deletion
Automatic rotation creates new key material for a KMS key on a schedule while keeping the old material so that existing data can still be decrypted. The key's ID and ARN do not change, so applications need no updates, and data does not need to be re-encrypted. AWS managed keys rotate every year. For customer managed symmetric keys, automatic rotation is optional, with a configurable period, and on-demand rotation is also available. Questions that ask for yearly key rotation with no operational effort point to automatic rotation on a customer managed key or to an AWS managed key, not to a scheduled script.
Deleting a KMS key is permanent and makes all data encrypted under it unrecoverable. KMS therefore enforces a waiting period of 7 to 30 days after you schedule deletion, during which the key is unusable but can be recovered. Disabling a key is the reversible alternative. A CloudWatch alarm on attempts to use a key pending deletion is a common safeguard that tells you something still depends on it.
KMS quotas
KMS has request rate quotas per account and Region for cryptographic operations, shared by all callers. Workloads that call KMS for every object, such as S3 with SSE-KMS at high request rates, can be throttled. The S3 Bucket Key feature reduces KMS calls from S3 by using a bucket level key for a period of time, cutting request costs and throttling risk substantially. Data key caching in the Encryption SDK does the same for client side encryption. When a scenario describes throttling or high KMS costs from S3, enabling S3 Bucket Keys is the expected answer.
Encryption context
Every KMS cryptographic request can include an encryption context, a set of non-secret key and value pairs. The same context must be supplied to decrypt, so ciphertext encrypted for one purpose cannot be decrypted by a request claiming another. The context is written to CloudTrail with each request, which makes logs far more useful: instead of seeing only that a key was used, you see which tenant, file or table it was used for. AWS services set an encryption context automatically; S3, for example, uses the object's ARN, and EBS uses the volume ID. Key policies can require specific context values, which ties permissions to data rather than only to keys.
Who can see what in CloudTrail
KMS logs management events, such as creating keys and changing key policies, and cryptographic operations, such as Decrypt and GenerateDataKey. When a service such as S3 calls KMS on behalf of a user, the CloudTrail event records the service and the original caller. A security team can therefore answer questions such as which roles decrypted objects in a sensitive bucket last week, something not possible with SSE-S3, where S3 manages keys internally. This audit capability is a frequent reason to prefer SSE-KMS in regulated environments.
Costs to keep in mind
Customer managed keys carry a monthly fee each, including for every rotated version of key material in some cases, plus a charge per ten thousand requests. AWS managed keys have no monthly fee but still incur request charges when used. For high request volumes, Bucket Keys and data key caching reduce the cost substantially. The exam may present a choice between SSE-S3 and SSE-KMS where the only stated requirement is encryption at rest at the lowest cost; in that case, SSE-S3 is enough.
Encryption at rest is a setting in most AWS services. What the exam tests is the key choice: AWS owned (no visibility), AWS managed (visible, not shareable) or customer managed (full control, shareable, can be disabled).