In this video, you’ll see how to manage software packages using AWS CodeArtifact.
With this service, you can manage your packages from a centralized repository,
ingest packages from third-party repositories,
and avoid the expense and effort of managing traditional repository infrastructure.
With CodeArtifact, your software packages are stored in repositories,
and the repositories are stored in a domain.
To get started, let’s create a new domain.
Artifacts in a domain are protected with an encryption key.
You can choose to use your own managed key or let AWS create one for you when you create the domain.
Let’s look at the domain details.
We can see ARNs for the domain, its Amazon Simple Storage Service (Amazon S3) bucket, and the encryption key.
We can also see any domain policies and apply new ones.
Sample policies are provided that allow you to set the governance type and limit access within the organization, if you want.
Next, let’s create a repository in this domain.
Repositories are typically named for a project or development team.
You can choose one or more public upstream repositories that connect your repository to official package authorities.
For demonstration purposes, we’ll select PyPI, the Python Package Index.
This diagram provides a high-level overview of the package flow used by CodeArtifact.
Let’s create the repository.
In the details, we can see the repository domain, ARN, and the associated upstream repository.
We also can apply a policy that’s specific to this repository.
As before, sample policies are provided to allow different levels of access for IAM users and AWS organizations.
After a repository is created, the next step is to connect it to a development environment.
Let’s review the connection instructions.
Note that you must install one of the AWS CLI versions shown to connect to the repository.
Connection instructions are specific to the selected package management service.
Since our repository will be used to store artifacts from PyPI, we’ll select pip.
In this case, two connection methods are provided.
The first method lets us use pre-configured AWS credentials to connect to CodeArtifact
and to configure a connection to the repository using the AWS CLI.
Please note that this method creates temporary credentials that expire after 12 hours.
The second method uses a generated CodeArtifact authentication token
to authorize a development environment to connect to a CodeArtifact repository.
It also enables the package management tool to pull from and push to that repository using the token.
In this case, we’ll use this second method.
First, we’ll copy the CodeArtifact authorization token.
Next, let’s head to our development environment to configure access to our CodeArtifact repository.
We’re using the Cloud9 development environment, but the same instructions apply to any development environment, whether local or cloud enabled.
We will first set the CodeArtifact authorization key as an environmental variable in our Bash profile configuration file.
Next, we’ll source our Bash profile to load it.
Next, we’ll print the CodeArtifact authorization token variable to ensure it outputs a value.
The next step is to configure pip to push and pull packages from our CodeArtifact repository.
We can copy the command from the connection instructions.
Paste the command and execute it.
Next, let’s install an example package.
Now that the package has finished installing,
let’s return to CodeArtifact to ensure that the connection has been established.
The example package, which is called “response,” has been added to our CodeArtifact repository
along with other Python packages it depends upon.
You can see the current version of each package.
As more versions of this package are added, they will be available here.
We can drill into the package version to see its description, dependencies, and assets.
Now let’s install a different version of the same package to ensure it shows up in the CodeArtifact interface.
Now both versions of the package are listed in the repository.
You’ve just seen how to manage your software packages using AWS CodeArtifact.
Thanks for watching. Now it’s your turn to try.