A developer is implementing a secure audit logging system where an application running on Amazon EC2 instances encrypts log files locally before uploading them to Amazon S3. A separate analytics service running on AWS Fargate needs to decrypt and process these log files. The developer wants to use a customer managed key (CMK) in AWS KMS for envelope encryption and must ensure that all encryption and decryption operations are cryptographically bound to the encryption context `{"Project": "Audit"}`.
Which TWO actions must the developer perform to successfully implement this security architecture?
- In the EC2 application code, call the `GenerateDataKey` API operation using the KMS key identifier and passing the encryption context `{"Project": "Audit"}` to retrieve both the plaintext data key and the encrypted data key.Cevap
- In the ECS task role policy of the Fargate service, grant `kms:Decrypt` permission for the CMK, and include a condition block that checks the `kms:EncryptionContext:Project` key is equal to `"Audit"`.Cevap
- CIn the EC2 application code, call the `Encrypt` API operation with the KMS key identifier and the encryption context `{"Project": "Audit"}` to directly encrypt each log file before upload.
- DIn the EC2 application code, call the `GenerateDataKeyWithoutPlaintext` API operation with the encryption context `{"Project": "Audit"}`, then call `Decrypt` on the returned ciphertext key to get the plaintext key for local encryption.
- EIn the ECS task execution role policy of the Fargate service, grant `kms:Decrypt` permission for the CMK, and append the encryption context value to the resource ARN.
Cevap
In the EC2 application code, call the GenerateDataKey API operation using the KMS key identifier and passing the encryption context {"Project": "Audit"} to retrieve both the plaintext data key and the encrypted data key; and in the ECS task role policy of the Fargate service, grant kms:Decrypt permission for the CMK, and include a condition block that checks the kms:EncryptionContext:Project key is equal to "Audit".
The correct options describe the proper implementation of client-side envelope encryption and IAM policy configuration. To encrypt files of arbitrary size, the producer must generate a data key using the `GenerateDataKey` API, passing the required encryption context. This context is cryptographically bound to the data key. On the consuming side, the application running inside the Fargate container needs permissions to decrypt the data key. Since this is an application runtime activity, the permission must be granted to the Fargate Task Role (rather than the Task Execution Role). The security policy enforces the use of the correct encryption context by using a condition block checking for the `kms:EncryptionContext:Project` key.
Adım Adım Çözüm
Anahtar Kavram
AWS KMS envelope encryption workflows, encryption context binding, and proper IAM role configuration for containerized services.
Tahmini Süre:2m 30s