You can use AWS Key Management Service (AWS KMS) to make and manage cryptographic keys that protect your data. Amazon EBS volumes are encrypted at rest by using AWS KMS keys. The following types of data are encrypted:
Data stored at rest on the volume
Disk I/O
Snapshots created from the volume
New volumes created from encrypted snapshots
Amazon EBS volumes that are attached to tasks can be encrypted by using either a default AWS managed key with the alias alias/aws/ebs
, or a symmetric customer managed key specified in the volume configuration. Default AWS managed keys are unique to each AWS account per AWS Region and are created automatically. To create a symmetric customer managed key, follow the steps in Creating symmetric encryption KMS keys in the AWS KMS Developer Guide.
You can configure Amazon EBS encryption by default so that all new volumes created and attached to a task in a specific AWS Region are encrypted by using the KMS key that you specify for your account. For more information about Amazon EBS encryption and encryption by default, see Amazon EBS encryption in the Amazon EBS User Guide.
You can also set up Amazon ECS cluster-level encryption for Amazon ECS managed storage when you create or update a cluster. Cluster-level encryption can be used to encrypt all Amazon EBS volumes attached to tasks running in a specific cluster by using the KMS key specified at the cluster level. For more information about configuring encryption at the cluster level, see ManagedStorageConfiguration in the Amazon ECS API reference.
You can configure any combination of these keys. The order of precedence of KMS keys is as follows:
The KMS key specified in the volume configuration. When you specify a KMS key in the volume configuration, it overrides the Amazon EBS default and any KMS key that is specified at the cluster level.
The KMS key specified at the cluster level. When you specify a KMS key for cluster-level encryption of Amazon ECS managed storage, it overrides Amazon EBS default encryption but does not override any KMS key that is specified in the volume configuration.
Amazon EBS default encryption. Default encryption applies when you don't specify either a cluster-level KMS key or a key in the volume configuration. If you enable Amazon EBS encryption by default, the default is the KMS key you specify for encryption by default. Otherwise, the default is the AWS managed key with the alias alias/aws/ebs
.
If you set encrypted
to false
in your volume configuration, specify no cluster-level KMS key, and enable Amazon EBS encryption by default, the volume will still be encrypted with the key specified for Amazon EBS encryption by default.
To encrypt an EBS volume that's attached to your task by using a customer managed key, you must configure your KMS key policy to ensure that the IAM role that you use for volume configuration has the necessary permissions to use the key. The key policy must include the kms:CreateGrant
and kms:GenerateDataKey*
permissions. The kms:ReEncryptTo
and kms:ReEncryptFrom
permissions are necessary for encrypting volumes that are created using snapshots. If you want to configure and encrypt only new, empty volumes for attachment, you can exclude the kms:ReEncryptTo
and kms:ReEncryptFrom
permissions.
The following JSON snippet shows key policy statements that you can attach to your KMS key policy. Using these statements will provide access for Amazon ECS to use the key for encrypting the EBS volume. To use the example policy statements, replace the
with your own information. As always, only configure the permissions that you need.user input placeholders
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111122223333
:role/ecsInfrastructureRole" },
"Action": "kms:DescribeKey",
"Resource":"*"
},
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111122223333
:role/ecsInfrastructureRole" },
"Action": [
"kms:GenerateDataKey*",
"kms:ReEncryptTo",
"kms:ReEncryptFrom"
],
"Resource":"*",
"Condition": {
"StringEquals": {
"kms:CallerAccount": "aws_account_id
",
"kms:ViaService": "ec2.region
.amazonaws.com"
},
"ForAnyValue:StringEquals": {
"kms:EncryptionContextKeys": "aws:ebs:id"
}
}
},
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111122223333
:role/ecsInfrastructureRole
" },
"Action": "kms:CreateGrant",
"Resource":"*",
"Condition": {
"StringEquals": {
"kms:CallerAccount": "aws_account_id
",
"kms:ViaService": "ec2.region
.amazonaws.com"
},
"ForAnyValue:StringEquals": {
"kms:EncryptionContextKeys": "aws:ebs:id"
},
"Bool": {
"kms:GrantIsForAWSResource": true
}
}
}
For more information about key policies and permissions, see Key policies in AWS KMS and AWS KMS permissions in the AWS KMS Developer Guide. For troubleshooting EBS volume attachment issues related to key permissions, see Troubleshooting Amazon EBS volume attachments to Amazon ECS tasks .
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4