Skip to main content

KMS Key Basic

๐Ÿ“ฆ Overviewโ€‹

This Terraform module provisions a basic AWS KMS (Key Management Service) key for centralized encryption needs.
It enables secure, reusable key management for S3, Lambda, EBS, and other AWS services.


โœ… Key Featuresโ€‹

  • Creates a customer-managed KMS key
  • Supports alias creation for easy reference
  • Includes tagging for environment-level organization
  • Enables encryption compliance across AWS workloads

๐Ÿ’ผ Use Casesโ€‹

  • Encrypting S3 buckets, EBS volumes, RDS snapshots, or Lambda environment variables
  • Centralized encryption management for application secrets and data
  • Compliance with data-at-rest encryption mandates (e.g., HIPAA, PCI-DSS)
  • Replacing default AWS-managed keys with customer-managed ones

๐Ÿ“ฅ Input Variablesโ€‹

NameTypeDescription
regionstringAWS region to deploy the KMS key
aliasstringUser-defined alias for the key (e.g., alias/archiphire-key)
environmentstringTag to specify the deployment environment (e.g., dev, prod)

๐Ÿ“ค Outputsโ€‹

NameDescription
key_idThe unique identifier of the KMS key
key_arnThe Amazon Resource Name of the key
alias_nameThe alias associated with the KMS key

๐Ÿš€ Deployment Readinessโ€‹

  • โœ… Compatible with Terraform 1.0+
  • โœ… Tested with AWS provider 5.x
  • ๐Ÿงช Requires IAM permissions for kms:* or specific key actions

๐Ÿ› ๏ธ Example Usageโ€‹

module "kms_key_basic" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//security/kms-key-basic?ref=v1.0.0"

region = "us-east-1"
alias = "alias/archiphire-app-key"
environment = "prod"
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

๐Ÿงน Cleanup Optionsโ€‹

Terraform Destroy (for test environments):

terraform destroy

or

tofu destroy

Manual Deletion (for production):

aws kms schedule-key-deletion --key-id "key_id" --pending-window-in-days 7

Use aws kms list-keys and describe-key to identify your KMS key.

๐Ÿ›ก๏ธ Notesโ€‹

This is a Level 1 security module intended for baseline encryption use. To extend functionality, attach custom key policies or grant cross-account access.

๐Ÿ”’ Deployment Package Noticeโ€‹

This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.