Use Encryption With EBS-backed AMIs (Part 1)
About
Amazon EBS snapshots can
be utilized for AMIs that are encrypted. Both root and data volume snapshots
can be encrypted and linked to an AMI. You are able to initiate instances and
duplicate images with complete support for EBS encryption. The encryption settings
for these actions are available in all Regions where AWS KMS is supported.
EC2 instances utilizing encrypted EBS volumes are started from AMIs in the same manner as other instances. Furthermore, when launching an instance from an AMI that is based on unencrypted EBS snapshots, you have the option to encrypt some or all of the volumes at the time of launch.
Similar to EBS volumes, AMI snapshots can be encrypted
using either your default AWS KMS key or a customer-managed key that you
designate. In all scenarios, it is essential to have permission to use the
chosen KMS key. AMIs that contain encrypted snapshots can be shared across
different AWS accounts.
Instance-launching Scenarios
Amazon EC2 instances are initiated from AMIs through the RunInstances action, with parameters provided via block device mapping, either through the AWS Management Console or directly using the Amazon EC2 API or CLI. By default, unless specific encryption parameters are provided, a RunInstances action preserves the existing encryption state of the AMI's source snapshots when restoring EBS volumes from them.
If default encryption is activated, all volumes generated from the AMI
(regardless of whether they come from encrypted or unencrypted snapshots) will
be encrypted. If default encryption is not activated, the instance retains the
encryption state of the AMI.
You can initiate an
instance and at the same time implement a new encryption state on the resulting
volumes by providing encryption parameters. As a result, the following
behaviors can be seen:
Launch With No Encryption
Parameters
- An unencrypted snapshot is restored to an unencrypted volume, unless encryption by default is enabled, in which case all the newly created volumes will be encrypted.
- An encrypted snapshot that you own is restored to a volume that is encrypted to the same KMS key.
- An encrypted snapshot that you do not own (for example, the AMI is shared with you) is restored to a volume that is encrypted by your AWS account's default KMS key.
- The 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:
Instance Launch Behaviors
With Encrypted Set, But No KmsKeyId Specified
- An unencrypted snapshot is restored to an EBS volume that is encrypted by your AWS account's default KMS key.
- An encrypted snapshot that you own is restored to an EBS volume 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 restored 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 non-default KMS key
for an encryption operation. The following behaviors result:
Instance With Both
Encrypted and KmsKeyId Set
- An unencrypted snapshot is restored to an EBS volume encrypted by the specified KMS key.
- An encrypted snapshot is restored to an EBS volume 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
Many instance-launching scenarios about Amazon EBS are discussed.
Comments
Post a Comment