Home AWS Cloud Understanding AMI Encryption and Sharing Across AWS Accounts

Understanding AMI Encryption and Sharing Across AWS Accounts

221
0

Introduction

Amazon Machine Image (AMI) is essentially a snapshot of a root filesystem that we can use to launch new instances. An AMI contains all the information necessary to start an instance, including the operating system, the application server, and applications. Encrypting AMIs protects sensitive data from unauthorized access, ensuring only entities with decryption keys can launch instances from these AMIs. It’s particularly crucial to comply with industry regulations and safeguard intellectual property or personal data. This encryption is done using AWS KMS keys.

How to Encrypt an AMI

Encrypting an AMI typically involves creating an encrypted snapshot of the EBS (Elastic Block Store) volumes associated with the AMI and then creating a new AMI from that snapshot. During this process, we specify a KMS key to be used for encryption.

Why Share Encrypted AMIs?

Sharing encrypted AMIs is useful when maintaining a secure and consistent environment across different AWS accounts. This could be for reasons such as organizational policies or compliance requirements or simply to ensure that environments are replicated accurately and securely in different parts of our organization.

Sharing Encrypted AMIs Across Accounts

Sharing an encrypted AMI involves more steps than sharing a regular, unencrypted AMI. Let’s break it down:

Step 1: Prepare the AMI for Sharing

Ensure the AMI we wish to share is encrypted using a customer-managed KMS key rather than the default AWS-managed KMS key. This is important because AWS does not allow sharing the default KMS keys across accounts.

Step 2: Grant access to the KMS Key

Before the target account can use the encrypted AMI, access to the KMS key used for encrypting the AMI’s underlying snapshots must be granted. This does not mean transferring the key itself but rather modifying the key’s policy to include permissions for the target account. Without access to this KMS key, the target account won’t be able to decrypt the AMI.

Step 3: Modify AMI Permissions

After ensuring the target account has access to the KMS key, we must modify the AMI’s launch permissions to allow the target account to use it. This is done by adding the target account as a permitted AWS account under the AMI’s “Permissions” tab in the AWS Management Console.

Step 4: Share the AMI ID with the Target Account

Once granted the necessary permissions, share the AMI ID with the target account. The administrator of the target account will then be able to launch instances from the shared AMI using the granted KMS key for decryption.

Optional: Re-encryption under the Target Account

Optionally, when launching an instance from the shared AMI, the target account can specify a new KMS key that it manages to re-encrypt the instance’s EBS volumes. This step ensures the target account has full control over the encryption keys used for its instances.

 

 

Conclusion

Sharing encrypted AMIs across AWS accounts ensures that we can maintain security and compliance standards while collaborating or migrating resources between accounts. By following the steps outlined above—preparing the AMI, granting access to the KMS key, modifying AMI permissions, and optionally re-encrypting with a new key—we can streamline the process of sharing encrypted resources in a secure manner. Remember, managing access to our KMS keys is crucial throughout this process to maintain the security and integrity of our encrypted AMIs.

Previous articleGetting Started with AWS Systems Manager (SSM)
Next articleUnderstanding Azure Service Tags
Heartin Kanikathottu
As a seasoned Cloud and Security Architect, I’ve led transformative initiatives in key roles, including Vice President at Morgan Stanley, Principal Architect at Societe Generale, and Tech Lead & Cloud Security Architect at VMware, among others. I’m also an internationally published author with multiple books available on platforms like Amazon and O'Reilly. Notably, one of my books was recognized as the 8th best cloud computing book of all time in 2020, reflecting the impact of my contributions to the field. With over 15 professional certifications from providers such as Microsoft (Azure), Amazon (AWS), Oracle (Java), Pivotal (Spring), and IBM, I bring a wealth of expertise to my work. Academically, I hold dual Master’s degrees in Cloud Computing and Data Analytics. I’m passionate about sharing knowledge and mentoring others, which is why I actively speak at global technical forums such as Tech Opportunities Fest at Platform Calgary, Google's Kubernetes Meetup, Java User Group, Elasticsearch Meetup, and the Agile India Conference.

LEAVE A REPLY

Please enter your comment!
Please enter your name here