nerdexam
AmazonAmazon

DOP-C02 · Question #358

DOP-C02 Question #358: Real Exam Question with Answer & Explanation

The correct answer is D: Create an instance profile that contains an IAM role that has access to CodeArtifact. Associate. Instance profile with IAM role: By creating an instance profile that contains an IAM role with permissions to access the CodeArtifact repository, the EC2 instance is granted the necessary access to retrieve packages. aws codeartifact login: The aws codeartifact login CLI command

Submitted by ravi_2018· Mar 6, 2026SDLC Automation

Question

A company uses an AWS CodeArtifact repository to store Python packages that the company developed internally. A DevOps engineer needs to use AWS CodeDeploy to deploy an application to an Amazon EC2 instance. The application uses a Python package that is stored in the CodeArtifact repository. A BeforeInstall lifecycle event hook will install the package. The DevOps engineer needs to grant the EC2 instance access to the CodeArtifact repository. Which solution will meet this requirement?

Options

  • ACreate a service-linked role for CodeArtifact. Associate the role with the EC2 instance. Use the
  • BConfigure a resource-based policy for the CodeArtifact repository that allows the
  • CConfigure ACLs on the CodeArtifact repository to allow the EC2 instance to access the Python
  • DCreate an instance profile that contains an IAM role that has access to CodeArtifact. Associate

Explanation

Instance profile with IAM role: By creating an instance profile that contains an IAM role with permissions to access the CodeArtifact repository, the EC2 instance is granted the necessary access to retrieve packages. aws codeartifact login: The aws codeartifact login CLI command configures the Python package manager (such as pip) on the instance to use the CodeArtifact repository, handling authentication and authorization automatically using the instance profile credentials.

Topics

#IAM roles#Instance profiles#CodeArtifact#EC2 permissions#CodeDeploy

Community Discussion

No community discussion yet for this question.

Full DOP-C02 PracticeBrowse All DOP-C02 Questions