← Cloud Practitioner study path

Security and compliance · 11 min

Encryption in AWS with AWS KMS and AWS Certificate Manager

In this lesson you will learn to tell encryption in transit from encryption at rest, how AWS KMS keys are used, how Amazon S3 encrypts by default and what AWS Certificate Manager is for.

Encrypting means turning data into unreadable text that can only be read with a key, which is a secret piece of data that only the people who should read it have. It means that if someone steals or intercepts your data, they can't understand any of it. For example, if an online store encrypts its customer list and someone steals it, they only see scrambled letters and numbers.

In the shared responsibility model, encrypting your data is your job: AWS provides the tools, and you decide what you encrypt and who can use the keys. The exam guide asks you to tell apart the two moments when data is encrypted and to know which AWS service is used in each one.

When is data encrypted?

A user sends data over HTTPS to an S3 bucket: the path is encryption in transit and the bucket stores the data encrypted at rest

Data is encrypted at two moments: while it travels over the network and while it is stored. Each of these types of encryption uses a different AWS service.

Encryption in transit protects data while it travels, for example from your to a or from your application to a . This encryption is done with TLS, which is the standard way to encrypt a connection and which you see in the browser as HTTPS and as the padlock next to the site's address. Thanks to it, someone who intercepts the connection only sees meaningless text. For example, when a customer types their card number into the store, TLS keeps someone on the same coffee shop Wi-Fi from reading it while it travels.

Encryption at rest protects data while it is stored on a disk, in a bucket or in a database. With this encryption, someone who took the disk couldn't read anything without the key. For example, the product photos the store keeps in a bucket in Amazon S3, the AWS service for storing files, are stored encrypted, so whoever took the disk they are on couldn't see them.

In transit or at rest?

0 of 5

Tap the correct column for each case.

  1. Your password travels from the browser to the server over HTTPS

  2. A photo stored in an S3 bucket

  3. Your application sends a query to the database over TLS

  4. Someone takes a disk and can't read anything without the key

  5. The rows stored in a database

AWS Key Management Service (AWS KMS)

Encrypting something leaves you with a key that also has to be protected, and if you encrypt that key, you have another key to look after. At some point the last key has to stay in a very secure place, and that is what AWS KMS is for. For example, if the store encrypts its customer list and leaves the key on the same server, whoever gets into the server takes both, and KMS prevents that by keeping the key separately.

With AWS KMS you create and control the keys you use to encrypt and data. These keys live in (HSMs) validated under FIPS 140-3 Security Level 3, a security standard for this kind of device, and never leave the service unencrypted. With key policies, which are permission documents like the ones in IAM, you decide who can use them, and every use is recorded in AWS CloudTrail, the service that writes down who did what in your account. For example, the store can decide that only the payments application uses the key for card data, and later check in CloudTrail every time someone used it.

Many AWS services use KMS to encrypt what they store, with two types of keys.

The two types of AWS KMS keys: AWS managed and customer managed

The two types differ in who creates the key, who uses it and how it is charged:

  • AWS managed keys, which an AWS service creates in your account to encrypt your data, which only that service uses and for which you pay for usage but not for their existence.
  • Customer managed keys, which you create, whose and usage you fully control and which have a monthly cost.

For example, if the store only wants its database encrypted and doesn't care who handles the key, the AWS managed key is enough. If it also wants to decide which employees can use the key and when to disable it, it creates a customer managed key and pays its monthly cost.

Which key do you choose?

Your team wants to decide who can use the key that encrypts its stored data and to control its entire lifecycle. What does it use?

How does Amazon S3 encrypt?

An object is each file you store in Amazon S3, like a photo or a PDF. Since January 5, 2023, every new object you upload to S3 is encrypted at rest even if you don't turn anything on. For this, S3 uses S3 managed keys (SSE-S3, with ), at no extra cost and without affecting . Objects that already existed before that date, however, weren't encrypted automatically.

Because basic S3 encryption is already in place, what you choose is who manages the key. If you want to control it yourself, you switch the bucket to SSE-KMS, which uses an AWS KMS key. For example, the photos the store uploads today are encrypted without it doing anything, but if its auditor asks the store to control the key for its invoices, the store switches the invoices bucket to SSE-KMS.

True or false?

0 of 4
  1. An object you upload to S3 today stays unencrypted until you turn on encryption.

  2. Objects that were already in S3 before January 5, 2023 were encrypted automatically.

  3. S3 default encryption has an extra cost.

  4. If you want to control a bucket's key, you switch it to SSE-KMS.

AWS Certificate Manager (ACM)

To use HTTPS, your site needs an SSL/TLS certificate, which is the file that lets the browser encrypt the connection with your server and check that the site is who it says it is. These certificates used to be bought, installed and renewed by hand, and now ACM does that work: it creates, stores and renews public and private certificates for your sites and applications on AWS. For example, if the store's certificate expires and nobody renews it, the browser shows every customer a not secure warning, and ACM avoids that problem by renewing it on its own.

You don't pay for the SSL/TLS certificates you manage with ACM, only for the resources where you use them. These certificates are regional, that is, they live in a single AWS Region, so to use one with you have to request or import it in US East (N. Virginia), us-east-1. For example, if the store works in another Region but serves its site with CloudFront, it has to request that site's certificate in us-east-1.

Match each piece with what it does

0 of 4 pairs

Tap a piece and then what it does.

0 of 4 pairs.

Accounts with the new experience

AWS KMS and AWS Certificate Manager are available from the free plan, although in ACM public certificates can't be exported, that is, taken out of AWS to be used somewhere else. The Region of that account is fixed (us-east-2 for Latin America), but its Region policy allows ACM to be used in us-east-1, which is where CloudFront requires the certificate. For example, if you practice with an account with the new experience, your resources stay in us-east-2, and you request the certificate for CloudFront in us-east-1.

On the exam

Questions on this topic describe data that has to be protected and ask you to choose the type of encryption or the service. For example, if the question talks about protecting passwords while they travel from the browser to the server, the answer is encryption in transit. These words in the question point to the answer:

Words in the question Answer
Data traveling over the network, HTTPS, TLS Encryption in transit, with a certificate from AWS Certificate Manager
Stored data, on disk, in the bucket Encryption at rest
Create and control encryption keys, who can use the key AWS KMS
SSL/TLS certificates, renewing certificates AWS Certificate Manager

Review question

A company wants to control the keys that encrypt its objects in Amazon S3 itself and decide which users can use them. Which service does it use?

Next