TechWriterDev
  • Cloud
    • AWS
      • 00_Doubts
      • CloudPractitioner
        • Cloud Computing
        • AWS Global Infrastructure
        • Introduction to AWS EC2
        • Elastic load balancer(ELB)
        • 04_Messaging_Queuing
        • Aditional Computing Service
        • Accessing AWS resources
        • AWS Networking
        • Storage
        • Amazon Database Solutions
        • Monitoring Tools
        • AWS Security
        • Distributed Denial Of Service Attacks
      • DeveloperAssociate
        • References
        • AWS DVA-C02 Services Index
        • Services
          • 00_IAM
            • Identity and Access Management (IAM)
            • Account Protection Mechanisms
            • Access Mechanism of AWS Resources
            • Security Tools
            • Responsibility Model
            • Advanced Concepts
          • 01_EC2
            • Elastic Compute Cloud (EC2)
            • EC2 Volume Types
            • Amazon Machine Image (AMI)
            • AWS charges for IPv4 address
          • 02_SecurityGroups
            • Security Groups
          • 03_Elastic_LoadBalancing
            • Terminology
            • Elastic load balancer
            • Features
            • Basics
          • 04_AutoScaling
            • Auto Scaling
          • 05_RDS
            • Relational Database Service (RDS)
            • Aurora
            • Security
            • RDS Proxy
          • 06_ElastiCache
            • Cache
            • Cache Offerings
          • 07_Route53
            • Basics of DNS
            • Route 53
          • 08_VPC
            • Virtual Private Cloud (VPC)
          • 09_S3
            • Simple Storage Service (S3)
            • S3 Features
            • S3 Encryption
            • S3 Features
            • S3 Bucket Policy and IAM Policy
          • 10_ECS
            • Elastic Container Service (ECS)
            • Elastic Container Registry (ECR)
            • AWS Copilot
          • 11_EKS
            • Elastic Kubernetes Service (EKS)
          • 12_SDK_CLI_Tips
            • Access AWS Resources
          • 13_CloudFront
            • Cloud Front
          • 14_Messaging
            • Simple Queue Service (SQS)
            • Simple Notification Service (SNS)
            • Fan Out Pattern
            • Kinesis
            • Compare and Contrast
          • 15_ElasticBeanStalk
            • Elastic Beanstalk
          • 16_CloudFormation
            • CloudFormation
            • Dynamic References
          • 17_Monitoring
            • AWS Monitoring
            • AWS CloudWatch
            • CloudWatch Alarms
            • Synthetics Canary
            • Amazon EventBridge (formerly CloudWatch Events)
            • X-Ray
            • OpenTelemetry
            • CloudTrail
          • 18_Lambda
            • Lambda
            • Lambda Integrations
            • Configuring Lambda
            • Lambda Layers
          • 19_API_Gateway
            • API Gateway
            • API Gateway Integrations
          • 20_DynamoDB
            • DynamoDB
            • Operations
            • Indexes
            • DynamoDB Accelerator (DAX)
            • DynamoDB Streams
            • Transactions
            • Integrations
          • 21_CICD
            • CICD
            • CodeCommit
            • CodePipeline
            • CodeBuild
            • CodeDeploy
            • CodeArtifact
            • CloudGuru
          • 22_SAM
            • Serverless Application Model (SAM)
          • 23_CDK
            • Cloud Development Kit (CDK)
          • 24_StepFunctions
            • Step Functions
            • Types of step function
          • 25_AppSync
            • AppSync
          • 26_Amplify
            • Amplify
          • 27_STS
            • Security Token Service (STS)
          • 28_DirectoryService
            • Active Directory
          • 29_KMS
            • Encryption
            • KMS API
            • Features
            • Cloud Hardware Security Module (HSM)
          • 30_SSM_Store
            • SSM Parameter Store
          • 31_SecretsManager
            • Secrets Manager
          • 32_Cognito
            • Cognito
      • Questions
        • AWS_Region
        • EC2
        • IAM
  • Database
    • MongoDb
      • Mongo db Basics
      • Mongo DB Atlas
      • Document
      • Import-Export based on Data Format
      • Mongo Shell Commands
      • Query Operators
      • Indexes
      • Upsert
      • MongoDB Aggregation Framework
      • Aggregation Framework Operators
    • PostgreSQL
      • POSTGRE SQL DataTypes
      • About table
      • Constraints
  • Technologies
    • RabbitMQ
      • RabbitMQ Concepts
      • Introduction to Exchanges
      • Introduction to Queues
    • Terraform
      • 00_Introduction
      • Configuration blocks
      • Commands
      • Variables
      • Terraform Cloud
      • Modules
  • Languages
    • Java
      • Logging
        • Getting Started
      • 00_Core
        • 00_Basics
          • Java Vs C++
          • Object oriented principles
          • Steps to compile a java program
          • JVM Internals
          • Understanding Java Development Kit
          • What is JIT Compiler?
          • Java data types
          • 07_identifiers_type_conversion
          • 08_references_and_packages
          • Steps for attaching scanner
        • Concurrency
          • 00_Threads
            • Threads
          • 01_ExecutorFramework
            • Executor Framework
            • Asynchronous Computation
      • 01_Backend
        • 01_HttpAndWebServerBasics
          • HTTP
          • Content Type
          • Web Server
        • 02_J2EE_Basics
          • J2EE_Basics
          • Why HttpServlet classs is declared as abstract class BUT with 100 % concrete functionality ?
        • 03_TomCatAndSession
          • What is a Session?
          • WebContainer
        • 04_PageNavigation
          • Cookies Additional Information
          • Page Navigation Techniques
        • 05_AboutServlet
          • CGI v/s Servlet
          • Executor Framework
          • Servlet Life cycle
          • SERVLET CONFIG
          • Servlet Context
          • Servlet Listener (web application listener)
        • 08_SpringBoot
          • Spring Boot
          • Some common annotations used in spring eco system
        • 09_SpringDataJPA
          • Spring Data JPA
        • Java_Language_Changes
          • JDK enhancement tracking reference
        • 06_ORM_Hibernate
          • readmes
            • Hibernate
            • Advantages of Hibernate
            • Hibernate Caching
            • Hibernate API
            • Hibernate Query API
            • Hibernate Annotations and JPQL
            • Entity and Value Type
        • 07_SpringFramework
          • bean_validation
            • Bean Validation
          • core
            • readme
              • Spring
              • Spring Framework Modules
              • Spring MVC Request flow
              • Dependency Injection
              • Spring Beans
              • 06_Spring_Framework_Annotations
      • 03_Tools
        • Maven
          • Maven
  • SoftwareEngineering
    • DesignPatterns
      • Notes
        • Basics
        • OOP
        • SOLID Principles
        • 03_Creational
          • Abstract Factory (aka Kit)
          • Builder
          • Factory Method (aka Virtual constructor)
          • Prototype
          • Singleton
        • 04_Structural
          • Adapter (aka Wrapper)
          • Bridge (aka Handle | Body)
          • Composite
          • Decorator (aka Wrapper)
          • Facade
          • Flyweight
          • Proxy (aka Surrogate)
        • 05_Behavioral
          • Chain of Responsibility
          • Command (aka Action | Transaction)
          • Iterator (aka Cursor)
          • Observer (aka Publish-Subscribe | Dependents)
          • Strategy (aka Policy)
    • Principles
      • REST
        • REST
  • Tools
    • Containers
      • Docker
        • Docker
        • Docker Image
        • Commands
        • Compose
        • Best Practices
      • Kubernetes
        • Kubernetes
    • VCS
      • Git
        • Quick reference of useful Git commands
Powered by GitBook
On this page
  • AWS Key Management Service (KMS)
  • Icon
  • About
  • KMS Keys
  • KMS Key Types
  • Key Rotation
  • KMS Key Policies
  • Default KMS Key Policy
  • Custom KMS Key Policy
  • KMS Quota
  1. Cloud
  2. AWS
  3. DeveloperAssociate
  4. Services
  5. 29_KMS

Encryption

Previous29_KMSNextKMS API

Last updated 4 months ago

  • In general, there are 3 types of encryption

    • Encryption in flight

      • This type of encryption is typically achieved using TLS/SSL certificates in HTTPS secured websites.

      • Encrypt before sending the data to server and decrypted after receving from the server.

      • This avoids MITM (Man in the middle) attacks.

    • Server Side encryption

      • Typically used to encrypt data in rest.

      • Data is encrypted after receiving at the server side and decrypted before sending to the requester using a key.

    • Client Side encryption

      • Encrypt and decrypt data at client side itself.

      • Used in Envelope encryption.

AWS Key Management Service (KMS)

Icon

AWS KMS Icon

About

  • Its a key management service offered by AWS.

  • It manages encryption keys for us.

  • Its fully integrated with IAM for authorization

  • CloudTrail provides audit trails of KMS key usage.

  • Seamlessly integrated into most AWS services like RDS, ECS, S3 ...

  • Never store your credentials in plain text, especially in your code, rather encrypt using KMS key and refer to encrypted secrets.

  • KMS key encryption is also available through API calls (SDK and CLI).

KMS Keys

  • They are scoped per region.

  • Can single region or multi-region (replicated) keys.

  • To copy an EBS volume encrypted with a KMS Key in region A to region B. The steps will be as follows,

    • Take a snapshot of encrypted EBS volume at region A.

    • Note same KMS Key cannot be kept in two different region.

    • Reencrypt the snapshot with a different KMS key at region A.

    • Restore the snapshot into region B.

KMS Key Types

  • KMS Keys is the new name of KMS Customer Master Key.

  • There are two types of them based on type of encryption mechanism.

  • Pricing to access KMS API costs around $0.03 cents per 10000 calls.

Based on ecryption mechanism

Symmetric KMS Key (AES-256)

  • Single encryption keys that is used to encrypt and decrypt keys.

  • AWS Service that are integrated with KMS use Symmetric CMKs.

  • You never get access to the KMS unencrypted, to use them use KMS API calls.

Asymmetric KMS Key (RSA and ECC)

  • Two keys i.e a pair are generated namely, public key to encrypt data and private key to decrypt data.

  • Used to Encrypt/Decrypt or sign/verify operations.

  • The public key is downloadable, but you cant access the private Key unencrypted.

  • Typically used when encryption needs to be done outside of AWS by users who can't access KMS API.

Based on Key Management

AWS Owned Keys

  • These are free keys not KMS but is a type of encryption keys used within AWS.

  • SSE-S3, SSE-SQS, SSE-DDB

AWS Managed Key

  • These are free keys.

  • Typically of the form aws/<service-name>. Example -> aws/rds.

  • Can only be used from within the service that is assigned to.

Customer managed keys

  • Costs $1/month.

  • Keys can generated by you and imported as well, pricing remains same i.e $1/month.

Key Rotation

  • Also provides automatic key rotations.

  • For AWS managed KMS keys, automatic rotation per year.

  • For Customer managed KMS keys, can enable automatic rotation or on demand rotation.

  • For imported KMS Keys, only manual rotation is possible using alias.

  • Key rotation history is also available for on-demand key rotation.

KMS Key Policies

  • Similar to S3 Bucket policies, but only difference being cannot control access without them.

  • If there is no KMS Key policy, then no one can access them.

Default KMS Key Policy

  • By default there is a KMS Key policy and is created if there is no specific KMS Key Policy.

  • Complete access to the key to the root user.

  • This default policy allows all users/roles (not service) in the account to access the keys if they have proper IAM permissions.

Custom KMS Key Policy

  • Custom Key Policy allows to control access to the key

    • Like users, roles that can access the KMS Key.

    • Define who can administer the key.

  • Useful for cross-account access to the KMS Key.

  • Example include, copying a volume's snapshots across account, which includes following steps.

    1. Create a snapshot, encrypted with your Customer managed KMS Key.

    2. Attach a KMS key policy to authorize a cross-account access.

    3. Share the encrypted snapshot.

    4. Create a copy of the snapshot, encrypt it with a different CMK in target account.

    5. Create a volume from snapshot.

KMS Quota

  • When the quota limit is exceeded, you get a ThrottlingException.

  • To resolve this issue, use exponential-backoff and retry.

  • Depending on the AWS region and type of CMK used in the request, each quota is calculated separately.

  • For cryptographic operations, they share a quota across account per region.

  • AWS support can increase the request quota if a ticket is opened.

KMS Quotas