A company's developers publish internal Python packages that several teams install with pip.
CodeBuild projects also install public packages from PyPI during builds. Security wants builds to use one private repository endpoint for both internal and public packages, and packages already fetched should stay available even if PyPI is unreachable. The company wants as few servers to manage as possible.
What should the developer set up?
Choose one answer.
AA. A pip package index on an Amazon EC2 instance that mirrors PyPI and also hosts the internal packages.
BB. An Amazon ECR repository where every Python package is stored as a container image.
CC. An AWS CodeArtifact repository for the internal packages that has an upstream repository with an external connection to PyPI.
DD. An Amazon S3 bucket holding the internal packages as wheel files, with builds also reaching PyPI through a NAT gateway.
Show the answer and explanation
Answer: C
A. Wrong: This can work, but the team must patch, scale and back up the server and keep the mirror up to date. A managed artifact repository gives the same endpoint without servers to run.
B. Wrong: ECR stores container images and OCI artifacts. pip cannot install packages from it, and it has no connection to PyPI.
C. Right: Correct. Builds use one CodeArtifact endpoint, and requests for public packages are passed to the upstream repository with the PyPI connection. Packages fetched that way are retained in CodeArtifact, so they remain available later. Learn more: Upstream repositories (opens in a new tab)
D. Wrong: Builds would use two sources, not one endpoint, and public packages would not be kept anywhere. The NAT gateway also adds cost and keeps the builds dependent on PyPI being reachable.
Explanation
CodeArtifact gives builds a single private endpoint. Linking the repository to an upstream repository that has an external connection to PyPI lets it serve public packages and retain the ones that were fetched. A self-run mirror adds servers, ECR cannot serve pip packages, and S3 plus a NAT gateway leaves two sources and no retention.
Want more on Packaging and application configuration? The 5 full-length practice sets have 15 more Packaging and application configuration questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →