What should the company do to restrict the developers’ ability to push changes to the main branch directly?
Create an additional policy to include a Deny rule for the GitPush and PutFile actions. Include a restriction for the specific repositories in the policy statement with a condition that references the main branch.
Remove the IAM policy, and add an AWSCodeCommitReadOnly managed policy. Add an Allow rule for the GitPush and PutFile actions for the specific repositories in the policy statement with a condition that references the main branch.
Modify the IAM policy. Include a Deny rule for the GitPush and PutFile actions for the specific repositories in the policy statement with a condition that references the main branch.
Create an additional policy to include an Allow rule for the GitPush and PutFile actions. Include a restriction for the specific repositories in the policy statement with a condition that references the feature branches.
Explanations:
This option is correct because adding a Deny rule specifically for theGitPushandPutFileactions with a condition that targets only the main branch effectively prevents direct pushes to the main branch, enforcing proper workflow.
This option is incorrect because the AWSCodeCommitReadOnly policy would prevent developers from pushing to any branch, including feature branches, which would hinder their work on the codebase.
This option is incorrect because modifying the AWSCodeCommitPowerUser managed policy is not possible. Instead, additional custom policies must be created to override the permissions for specific branches.
This option is incorrect because adding an Allow rule for GitPush and PutFile actions on feature branches would not prevent developers from pushing directly to the main branch, which is the requirement.