AWS CodeArtifact

Search for a command to run...

No comments yet. Be the first to comment.
AWS DataSync is a powerful service to move data between a range of sources and destinations. Being a managed service, it frees us from having to manage and maintain the infrastructure as well as the data transfer logic. While experimenting with AWS D...
Scenario - From Network Fileshare/device This is the scenario where the files are generated or updated to some file share/network drives. EC2 instance Sometimes, the the files may be generated to a network device that your VPC may have access to, lik...

The first part of this blog series discusses updating EFS placed in private subnet using AWS CodePipeline. This post discusses achieving the same using a lambda function as the heart of the solution. Using Lambda function - High Level Have the files...

Amazon EFS is a widely used AWS service. Be it applications running in EC2 instances or containers or serverless apps, EFS provide the 'external file storage' or a 'shared file storage' capability. Since the same EFS can be mounted from different pla...

Many tools and applications publish their docker images to docker hub and other public repositories, and many of them supply a docker-compose file to help with a boiler plate deployment. Those are helpful when you are playing around with the applicat...

CodeArtifact has been in AWS' devops tool set since mid 2020, but I haven't explored it until about 6 months ago. Being the lazy person I am, I get to explore things only when I have to. And the case wasn't any different here either.
A few days ago I did a brief presentation on AWS CodeArtifact in AWSMeetup Auckland. This is my attempt to share the discussion here.
It is a managed package management tool (like Jfrog's Artifactory, Sonatype's Nexus etc.) 'Managed' is the key - you don't need to maintain the tool by yourself and you don't have to worry about scaling as your packages grow in number and size. Obviously it comes with a cost, but it is "Pay as you go" much like many other AWS services and with no upfront cost or whatsoever. And if you think it is not meeting your expectations, delete it and be happy again!
The two key buzz words with AWS CodeArtifact are Domain and Repository.
A domain is how you organize your repositories. In a layman's terms let us say it is a 'folder' or 'directory' of repositories. Each domain can have one or more repositories. Access to a domain is controlled by a 'Domain Policy' (much like a S3 bucket policy or KMS policy).
A repository is where you store your packages/artifacts. Each repository is part of a domain and has its own individual repository policy to control access.
And then there is a third one, Upstream. Upstream represents the public upstream repository (or repositories) from where your repositories may be downloading dependencies for you, like PyPi, Maven Central etc.

Well, that depends. If you are starting small, running workload in AWS and your binaries (and future packages) belong to supported types (python, node, dot Net and Java) AWS CodeArtifact is a good natural choice.
If you want to make sure that your package upload doesn't leave your VPC, CodeArtifact is your friend, thanks to VPC endpoints.
Access policies at the repository and domain level helps in defining fine grained access control. For example, you can have a "Web-components" domain with dev-web, test-web and prod-web repositories in it. The domain policy can be setup to allow access by all developers, but the repository policy restrict developers from uploading packages to the test-web and prod-web repositories while allowing full access to the dev-web repository. Your automated build/publish process can be configured to allow "upload" (publish) packages to the relevant repositories.
Another nice thing about AWS CodeArtifact repositories is that they can be "untyped". That is, it can be configured to have multiple upstream and hold multiple package types in the same repo (python, npm, java, .Net). If that is a legitimate use case you need to support, AWS CodeArtifact can be an option.
Support Encryption at rest, by using KMS.
AWS CodeArtifact is somewhat similar to AWS ECR. One need to login to the repository and that login command is somewhat wordy and a bit too long.
aws codeartifact login --tool pip --repository dev-web --domain engineering-dev --domain-owner 999933311111 --region ap-southeast-2
Or if VPC endpoint is used
aws codeartifact login --tool pip --repository dev-web --domain engineering-dev --domain-owner --endpoint-url https://vpce-asdf879p3rasdmbmb.api.codeartifact.ap-southeast-2.vpce.amazonaws.com --region ap-southeast-2
CodeArtifact doesn't come with a package scanning (vulnerability scanning) for the uploaded or downloaded packages. At least a package blacklisting would have been very beneficial, but no such features to avail (at least until now).
Supported package types is another limitation. The other package managers (like Artifactory) support most of the package types while CodeArtifact supports only a small subset of them. Lack of support for RPMs, RubyGems and Zip/tar is indeed a drawback.
I would say it is a useful tool, in certain scenarios. If you want to build and publish from within your network/vpc or if you want your applications/services running in subnets with no Internet access to receive packages, AWS CodeArtifact presents an easy solution. At a very high level it could look something like the diagram below.

AWS CodeArtifact is a managed service and that comes with a cost. The cost has multiple components