exam questions

Exam AWS Certified Solutions Architect - Professional SAP-C02 All Questions

View all questions & answers for the AWS Certified Solutions Architect - Professional SAP-C02 exam

Exam AWS Certified Solutions Architect - Professional SAP-C02 topic 1 question 480 discussion

A solutions architect is creating an AWS CloudFormation template from an existing manually created non-production AWS environment. The CloudFormation template can be destroyed and recreated as needed. The environment contains an Amazon EC2 instance. The EC2 instance has an instance profile that the EC2 instance uses to assume a role in a parent account.

The solutions architect recreates the role in a CloudFormation template and uses the same role name. When the CloudFormation template is launched in the child account, the EC2 instance can no longer assume the role in the parent account because of insufficient permissions

What should the solutions architect do to resolve this issue?

  • A. In the parent account, edit the trust policy for the role that the EC2 instance needs to assume. Ensure that the target role ARN in the existing statement that allows the sts:AssumeRole action is correct. Save the trust policy.
  • B. In the parent account, edit the trust policy for the role that the EC2 instance needs to assume. Add a statement that allows the sts:AssumeRole action for the root principal of the child account. Save the trust policy.
  • C. Update the CloudFormation stack again. Specify only the CAPABILITY_NAMED_IAM capability.
  • D. Update the CloudFormation stack again. Specify the CAPABILITY_IAM capability and the CAPABILITY_NAMED_IAM capability.
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
SKS
Highly Voted 1 year ago
Answer is A . The error occurs because the trust relationship in the parent account that allows the EC2 instance to assume a role may have been broken or misconfigured. This can happen when a role is recreated with a different ARN but the same role name. The trust policy must be updated to reflect the correct ARN. Option A addresses this by ensuring that the trust policy in the parent account contains the correct ARN for the role in the child account, allowing the sts:AssumeRole action. Option B, which allows the root principal to assume the role, is risky and should be avoided due to security implications.
upvoted 8 times
...
jtzt2003
Highly Voted 1 year ago
Selected Answer: A
It is A. B is incorrect because specifying the root principal opens access up to all principals in the child account that are allowed to use sts.
upvoted 5 times
...
dv1
Most Recent 4 months, 3 weeks ago
Selected Answer: B
There is no role ARN in the statement of a trust policy (only principal), so A is not correct.
upvoted 1 times
...
TomTom
5 months, 1 week ago
Selected Answer: A
A is correct. There is a statement in the question: "The EC2 instance has an instance profile that the EC2 instance uses to assume a role in a parent account." Therefore: Option A is the most accurate solution to address the issue of the EC2 instance not being able to assume the role in the parent account.
upvoted 1 times
...
liuliangzhou
7 months, 2 weeks ago
Selected Answer: A
This option is directly related to the issue mentioned in the explanation. When a character is recreated in a sub account, its ARN will change, but the character name may remain unchanged. If the ARN in the trust policy is not updated to reflect the new ARN, the EC2 instance will not be able to successfully assume that role. Therefore, updating the trust policy to include the correct ARN is the key to solving the problem. The 'correct ARN' here should refer to the ARN currently held by the character recreated in the parent account. That is to say, the corresponding ARN in the parent account policy needs to be updated. Option B adds a statement that allows the sub account root principal to perform the sts: AssemeRole operation. This is usually not the best practice, as allowing the root account to directly assume roles would pose security risks. The root account is the most powerful identity in AWS accounts and should be strictly protected.
upvoted 2 times
...
asquared16
8 months, 2 weeks ago
Selected Answer: B
It's B for sure
upvoted 1 times
...
RotterDam
9 months ago
Selected Answer: A
(A) Because EC2 Instance 's role must be added as a trusted principal so that the parent role can trust it
upvoted 2 times
...
mark_232323
9 months, 2 weeks ago
Selected Answer: B
The issue is that the EC2 instance in the child account cannot assume the role in the parent account due to insufficient permissions, even though the role has been recreated in the CloudFormation template with the same name. Editing the trust policy of the role in the parent account and ensuring the target role ARN is correct does not grant the necessary permissions for the child account to assume the role. The trust policy governs which principals (accounts, users, roles, or services) are allowed to assume the role. In this case, the correct solution is option B
upvoted 2 times
...
trungtd
10 months, 4 weeks ago
Selected Answer: C
it's custom IAM role name so C
upvoted 1 times
...
titi_r
11 months, 1 week ago
Selected Answer: A
Should be "A".
upvoted 4 times
...
titi_r
1 year ago
In IAM roles, use the Principal element in the role trust policy to specify who can assume the role. For cross-account access, you must specify the 12-digit identifier of the trusted account. […] When you allow access to a different account, an administrator in that account must then grant access to an identity (IAM user or role) in that account. When you specify an AWS account, you can use the account ARN (arn:aws:iam::account-ID:root), or a shortened form that consists of the "AWS": prefix followed by the account ID.
upvoted 1 times
titi_r
1 year ago
E.g.: "Principal": { "AWS": "arn:aws:iam::123456789012:root" } "Principal": { "AWS": "123456789012" } The account ARN and the shortened account ID behave the same way. Both delegate permissions to the account. Using the account ARN in the Principal element does not limit permissions to only the root user of the account. https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html https://aws.amazon.com/blogs/security/how-to-use-trust-policies-with-iam-roles A or B?!
upvoted 1 times
...
...
tushar321
1 year ago
C https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html#:~:text=If%20you%20have%20IAM%20resources%20with%20custom%20names%2C%20you%20must%20specify%20CAPABILITY_NAMED_IAM
upvoted 2 times
...
teo2157
1 year ago
Selected Answer: B
The solutions architect should ensure that the trust relationship of the role in the parent account allows the child account to assume the role. The trust relationship is defined in the role's trust policy. The trust policy should specify the AWS account ID of the child account as a Principal.
upvoted 2 times
...
devnv
1 year ago
B is the correct answer
upvoted 1 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago