
Answer-first summary for fast verification
Answer: Create an IAM role that has read access to the Parameter Store parameter. Allow Decrypt access to an AWS Key Management Service (AWS KMS) key that is used to encrypt the parameter. Assign this IAM role to the EC2 instance.
## Explanation **Correct Answer: A** ### Why Option A is Correct: 1. **IAM Role for EC2 Instance**: EC2 instances should use IAM roles (not IAM policies directly attached) to access AWS services. IAM roles provide temporary credentials that are automatically rotated, which is more secure than using long-term access keys. 2. **Read Access to Parameter Store**: The application needs to retrieve the database credentials from Parameter Store, so the role must have `ssm:GetParameter` permission. 3. **KMS Decrypt Permission**: When using a secure parameter (encrypted with KMS), the application also needs `kms:Decrypt` permission on the KMS key used to encrypt the parameter. Without this permission, the EC2 instance cannot decrypt the stored credentials. 4. **Role Assignment**: The IAM role should be attached to the EC2 instance profile, allowing the application running on the instance to assume the role and access the secured parameter. ### Why Other Options are Incorrect: **Option B**: While the policy permissions are correct, IAM policies cannot be directly assigned to EC2 instances. Policies must be attached to IAM roles, which are then assigned to EC2 instances via instance profiles. **Option C**: This is incorrect because: - Parameter Store parameters are not IAM entities that can have trust relationships - Trust relationships are for IAM roles, not parameters - Amazon RDS as a principal doesn't make sense in this context **Option D**: This is incorrect because: - DB instances cannot have IAM trust relationships - Trust relationships are for IAM roles, not RDS instances - Systems Manager as a principal doesn't address the EC2 instance's need to access the parameter ### Best Practice Implementation: ```json // IAM Role Policy Example { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:GetParameter", "ssm:GetParameters" ], "Resource": "arn:aws:ssm:region:account-id:parameter/your-parameter-name" }, { "Effect": "Allow", "Action": "kms:Decrypt", "Resource": "arn:aws:kms:region:account-id:key/key-id" } ] } ``` ### Security Benefits: 1. **No hardcoded credentials** in application code or configuration files 2. **Automatic credential rotation** through IAM roles 3. **Encryption at rest** using KMS 4. **Fine-grained access control** through IAM policies 5. **Audit trail** through CloudTrail logging of Parameter Store access
Ultimate access to all questions.
No comments yet.
Author: LeetQuiz Editorial Team
A solutions architect needs to securely store a database user name and password that an application uses to access an Amazon RDS DB instance. The application that accesses the database runs on an Amazon EC2 instance. The solutions architect wants to create a secure parameter in AWS Systems Manager Parameter Store. What should the solutions architect do to meet this requirement?
A
Create an IAM role that has read access to the Parameter Store parameter. Allow Decrypt access to an AWS Key Management Service (AWS KMS) key that is used to encrypt the parameter. Assign this IAM role to the EC2 instance.
B
Create an IAM policy that allows read access to the Parameter Store parameter. Allow Decrypt access to an AWS Key Management Service (AWS KMS) key that is used to encrypt the parameter. Assign this IAM policy to the EC2 instance.
C
Create an IAM trust relationship between the Parameter Store parameter and the EC2 instance. Specify Amazon RDS as a principal in the trust policy.
D
Create an IAM trust relationship between the DB instance and the EC2 instance. Specify Systems Manager as a principal in the trust policy.