KMS Flashcards
KMS is fully integrated with
with IAM for authorization so that makes the management of these rules very simple and centralized.
you can use it with CLI and AWS SDK
KMS is integrated into
- EBS: encrypt volumes
- S3: server side encryption of objects
- Redshift: encryption of data
- RDS: encryption of data
- SSM: parameter store
use symmetric keys
two types of keys (exam)
- AES-256 bit symmetric (single key for encryption and decryption )
necessary for envelope encryption
(symmetric is more on the exam) - RSA and ECC asymmetric key pairs: Used for encryption / decryption and for Sign/Verify
The public key is something you can download
but again, access to the private key is impossible.
access to AES-256 bit symmetric Customer Master Key
you actually never get access to the key unencrypted
you must use the KMS API to use that key and you actually never see the key.
asymmetric CMS scenarios (exam)
- to cryptographically verify a digital signature client-side without the need for a network connection.
- customers can use KMS to securely manage decryption of data that has been encrypted by a partner’s system that does not integrate with AWS APIs or have access to AWS account credentials.
Key Management Service: what features are offered
- manage keys and policies (create, rotate policies, disable, enable)
- audit key usage (CloudTrail)
KMS pricing
three types of CMK:
- AWS managed service default customer master key, which is free so this is the idea when you go into EBS volume and use the AWS/EBS key, this is going to be free.
- if you create your own keys, this is $1 per month and there is no free tier and
- if you import your own keys,
so if you have to generate them outside of KMS
you’re going to pay for each API call done to KMS so we’re talking about 3 cents per 10,000 calls.
So when would you use KMS?
you need to share some sensitive information
- database passwords,
- credentials for an external service,
- a private key of SSL certificates,
or anything you need to encrypted is going to be secret,
the real value of KMS is that
- we actually don’t see the keys to encrypt the data or decrypt so the whole security belongs with AWS. We can only send data to KMS to decrypt and encrypt
- On top of it, KMS can rotate these keys for extra security.
KMS has a limit,
and you can only encrypt up to 4 kilobytes of data per call and so, if you want to have more data encrypted,
then you need to use something called envelope encryption which is advanced and you only need to know in the certified developer exam.
So, to give access to KMS to someone,
they need to make sure that
- the key policy allows the user to access the key
- as well the IAM policy to allow the API call
and when these two things are together, then you get access to KMS key.
KMS and regions
with your KMS keys are bound to a specific region. So that means that when you create a KMS key in region A it cannot be transmitted over to region B.
So let’s say we have an encrypted EBS volume with KMS and a KMS key in the region eu-west-2 and we’d like to copy that volume across to a new region
for example, ap-southeast-2. So, because KMS keys are linked to a specific region you would need to do a specific operation.
- create a snapshot of your volume and any snapshot made from an encrypted volume is also encrypted with KMS and the same key.
- copy that snapshot over to the new region but you will specify a new KMS key to re-encrypt the data with
and now you have a snapshot encrypted with KMS
in the other region but with a new key. - when you recreate a volume from that snapshot
then that volume will be encrypted with a new KMS Key B.
key policies
control access to KMS keys, without them you can’t control access
if you don’t specify a key policy, then no one can access your key.
When you create a CMK programmatically—that is, with the AWS KMS API (including through the AWS SDKs and command line tools)—you have the option of providing the key policy for the new CMK. If you don’t provide one,
AWS KMS creates one for you.
This default key policy has one policy statement that gives the AWS account (root user) that owns the CMK full access to the CMK and enables IAM policies in the account to allow access to the CMK.