Use Encryption With EBS-backed AMIs (Part 2)

 





Encrypt a volume during launch

In below figure, an AMI backed by an unencrypted snapshot is used to launch an EC2 instance with an encrypted EBS volume.

Fig shows: Encrypting a volume during launch-An AMI backed by an... |  Download Scientific Diagram

 

The Encrypted parameter by itself leads to the encryption of the volume for this instance. Specifying a KmsKeyId parameter is not mandatory. If a KMS key ID is not provided, the volume will be encrypted using the default KMS key associated with the AWS account. To use a different KMS key that you possess for encrypting the volume, include the KmsKeyId parameter.

Re-encrypt a volume during launch

In the figure below, an AMI backed by an encrypted snapshot is used to launch an EC2 instance with an EBS volume encrypted by a new KMS key.

Use encryption with EBS-backed AMIs - Amazon Elastic Compute Cloud

If you have ownership of the AMI and do not provide any encryption parameters, the resulting instance will have a volume that is encrypted using the same KMS key as the snapshot. In the case where the AMI is shared with you rather than owned by you, and no encryption parameters are provided, the volume will be encrypted using your default KMS key. When specific encryption parameters are given as detailed, the volume will be encrypted using the designated KMS key.

Image-copying scenarios

Amazon EC2 AMIs can be duplicated by utilizing the CopyImage function, either via the AWS Management Console or directly through the Amazon EC2 API or CLI. By default, unless specific encryption parameters are provided, the CopyImage action retains the current encryption status of the source snapshots of an AMI during the copying process. Additionally, you have the option to copy an AMI while also implementing a new encryption status for its related EBS snapshots by including encryption parameters.

Consequently, the following behaviors are observed:

Copy with no encryption parameters

  • An unencrypted snapshot is copied to another unencrypted snapshot, unless encryption by default is enabled, in which case all the newly created snapshots will be encrypted.

  • An encrypted snapshot that you own is copied to a snapshot encrypted with the same KMS key.

  • An encrypted snapshot that you do not own (that is, the AMI is shared with you) is copied to a snapshot that is encrypted by your AWS account's default KMS key.

All of these default behaviors can be overridden by supplying encryption parameters. The available parameters are Encrypted and KmsKeyId. Setting only the Encrypted parameter results in the following:

Copy-image behaviors with Encrypted set, but no KmsKeyId specified

  • An unencrypted snapshot is copied to a snapshot encrypted by the AWS account's default KMS key.

  • An encrypted snapshot is copied to a snapshot encrypted by the same KMS key. (In other words, the Encrypted parameter has no effect.)

  • An encrypted snapshot that you do not own (i.e., the AMI is shared with you) is copied to a volume that is encrypted by your AWS account's default KMS key. (In other words, the Encrypted parameter has no effect.)

Setting both the Encrypted and KmsKeyId parameters allows you to specify a customer managed KMS key for an encryption operation. The following behaviors result:

Copy-image behaviors with both Encrypted and KmsKeyId set

  • An unencrypted snapshot is copied to a snapshot encrypted by the specified KMS key.

  • An encrypted snapshot is copied to a snapshot encrypted not to the original KMS key, but instead to the specified KMS key.

Submitting a KmsKeyId without also setting the Encrypted parameter results in an error.

Conclusion

Some other details about using encryption with EBS-backed AMIs are discussed. 































Comments

Popular posts from this blog

Deployment (Part 3)

Deployment (Part 1)

Deployment (Part 2)