exam questions

Exam AWS Certified Security - Specialty All Questions

View all questions & answers for the AWS Certified Security - Specialty exam

Exam AWS Certified Security - Specialty topic 1 question 478 discussion

Exam question from Amazon's AWS Certified Security - Specialty
Question #: 478
Topic #: 1
[All AWS Certified Security - Specialty Questions]

An Amazon EC2 Auto Scaling group launches Amazon Linux EC2 instances and installs the Amazon CloudWatch agent to publish logs to Amazon CloudWatch Logs. The EC2 instances launch with an IAM role that has an IAM policy attached. The policy provides access to publish custom metrics to CloudWatch. The EC2 instances run in a private subnet inside a VPC. The VPC provides access to the internet for private subnets through a NAT gateway.

A security engineer notices that no logs are being published to CloudWatch Logs for the EC2 instances that the Auto Scaling group launches. The security engineer validates that the CloudWatch Logs agent is running and is configured properly on the EC2 instances. In addition, the security engineer validates that network communications are working properly to AWS services.

What can the security engineer do to ensure that the logs are published to CloudWatch Logs?

  • A. Configure the IAM policy in use by the IAM role to have access to the required cloudwatch: API actions that will publish logs.
  • B. Adjust the Amazon EC2 Auto Scaling service-linked role to have permissions to write to CloudWatch Logs.
  • C. Configure the IAM policy in use by the IAM role to have access to the required AWS logs: API actions that will publish logs.
  • D. Add an interface VPC endpoint to provide a route to CloudWatch Logs.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
OCHT
Highly Voted 2 years, 2 months ago
Selected Answer: A
The IAM role associated with the EC2 instances needs to have the necessary permissions to perform actions on the CloudWatch service, particularly to be able to publish logs to CloudWatch Logs. This can be achieved by modifying the IAM policy attached to the IAM role, granting the required permissions to perform the necessary API actions on CloudWatch. Option B is incorrect because the service-linked role for Amazon EC2 Auto Scaling has pre-defined permissions that cannot be changed. Option C is incorrect because there is no AWS service named "AWS logs". The correct service name is "CloudWatch Logs". Option D is incorrect because the question already mentions that the network communications to AWS services are working properly. So, there's no need to add a VPC endpoint for CloudWatch Logs.
upvoted 6 times
eDsdfqioN
2 weeks, 2 days ago
You need to grant action logs:xxx, not cloudwatch:xxx. Hence C should be correct instead of A.
upvoted 1 times
...
...
Salah21
Most Recent 1 year, 9 months ago
Selected Answer: A
The role being used to push the logs is the one the EC2s are being launched with and not the auto scaling one.
upvoted 1 times
...
cherry23
2 years, 1 month ago
Selected Answer: C
The EC2 instances launch with an IAM role that has an IAM policy attached. The policy provides access to publish custom metrics to CloudWatch. Which is cloudwatch: so B is out
upvoted 1 times
...
_henk_
2 years, 1 month ago
Selected Answer: C
The logs that are not being published to CloudWatch Logs are generated by the Amazon CloudWatch agent. The Amazon CloudWatch agent publishes the logs. It runs on the EC2 instances, so it uses the IAM role. That rules out answer B. The network communications are working properly, so that rules out answer D. The actions needed in the IAM policy start with logs: (note the : ) That rules out answer A. For examples: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-identity-based-access-control-cwl.html#w135aac34c16c15c25c11
upvoted 2 times
...
vherman
2 years, 1 month ago
Selected Answer: C
C is correct
upvoted 1 times
vherman
2 years, 1 month ago
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams" ], "Resource": [ "arn:aws:logs:*:*:*" ] } ] }
upvoted 1 times
...
...
Green53
2 years, 2 months ago
Selected Answer: A
I think some are being confused because it mentions autoscaling. I'm reading this as what the engineer has to do to ensure the EC2 instances can publish logs to CloudWatch, rather than the Autoscaling service itself. Read: "no logs are being published to CloudWatch Logs for the EC2 instances". Since the IAM role has a policy that "provides access to publish custom metrics to CloudWatch", it would also require access to publish logs. Option *A* is the only one that can do this. https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/permissions-reference-cwl.html It seems while you can creat custom roles, you can't amend the permissions for Autoscaling: The permissions of a custom suffix service-linked role are identical to those of the default service-linked role. In both cases, you cannot edit the roles, and you also cannot delete them if they are still in use by an Auto Scaling group. The only difference is the role name suffix. https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html Answer is A
upvoted 2 times
...
6_8ftwin
2 years, 2 months ago
Selected Answer: B
I think the answer is B. Although, service-linked roles can't be adjusted. They have to be deleted (as well as any resources using them) and recreated. https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role
upvoted 1 times
...
danielklein09
2 years, 2 months ago
Selected Answer: B
cloudwatch — Create, describe, modify, and delete CloudWatch alarms for scaling policies and retrieve metrics used for predictive scaling. Permissions that service-linked role for Amazon EC2 Auto Scaling has. https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html#service-linked-role-permissions
upvoted 1 times
PragyaSri
2 years, 2 months ago
"You cannot edit the service-linked roles that are created for Amazon EC2 Auto Scaling. After you create a service-linked role, you cannot change the name of the role or its permissions." -- from the above link.
upvoted 1 times
...
...
Enzao
2 years, 2 months ago
Selected Answer: B
Answer B
upvoted 2 times
...
cloudenthusiast
2 years, 2 months ago
Selected Answer: B
option B: Adjust the Amazon EC2 Auto Scaling service-linked role to have permissions to write to CloudWatch Logs. The service-linked role is automatically created and used by EC2 Auto Scaling to perform certain actions on behalf of the user, such as launching and terminating instances. By default, the service-linked role for EC2 Auto Scaling does not have permissions to write logs to CloudWatch Logs. To enable the EC2 instances in the Auto Scaling group to publish logs to CloudWatch Logs, the security engineer should modify the IAM policy attached to the service-linked role and grant the necessary permissions to write logs. This can be achieved by adding the appropriate logs:CreateLogStream and logs:PutLogEvents actions to the IAM policy.
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...