OVERVIEW AWS CODE ARTIFACT FOR STORING , PUBLISHING AND SHARING SOFTWARE PACKAGES.

ABOUT AWS CODE ARTIFACT

AWS CodeArtifact is a fully managed artifact repository service that makes it easy for organizations of any size to securely store, publish, and share software packages used in their software development process. CodeArtifact can be configured to automatically fetch software packages and dependencies from public artifact repositories so developers have access to the latest versions. CodeArtifact works with commonly used package managers and build tools like Maven, Gradle, npm, yarn, twine, pip, and NuGet making it easy to integrate into existing development workflows.

LAUNCHING AWS CLOUDSHELL

Note all the commands mentioned under this article will be executed from the CLOUDSHELL so we should launch cloudshell with user which is having requried rights on CODEARTIFACT service.

STEPS INVOLVED IN CREATING A CODEARTIFACT REPOSITORY AND RESOLVING DEPENDENCY

creation of domain

AWS CodeArtifact domain is a resource for codeartifact of AWS. CodeArtifact domains make it easier to manage multiple repositories across an ograginizatio. we can use a domain to apply permission across mulitple repositories owned by diffreent AWS accounts. Repositories are aggregated into a higher-level entity known as a domain. All package assets and metadata are stored in the domain, but they are consumed through repositories.

create a codeartifact domain command

aws codeartifact create-domain –domain my-domain

creating repository under above created domain

RUN FOLLOWING COMMANDS IN SEQUENCE TO

  • Create a domain
  • Create repository under the above domain
  • Create upstream repository for our above created repository
  • Add external connection to the npm public repository
  • Using CLI to install the npm package

COMMANDS WHICH NEEDS TO BE EXECUTED

1) Create a domain:
aws codeartifact create-domain –domain my-domain

2) Create a repository in your domain:
aws codeartifact create-repository –domain my-domain –repository my-repo

3) Create an upstream repository for your my-repo repository:
aws codeartifact create-repository –domain my-domain –repository npm-store

4) Add an external connection to the npm public repository to your npm-store repository:
aws codeartifact associate-external-connection –domain my-domain –repository npm-store –external-connection “public:npmjs”

5) Associate the npm-store repository as an upstream repository to the my-repo repository:
aws codeartifact update-repository –repository my-repo –domain my-domain –upstreams repositoryName=npm-store

6) Configure the npm package manager with your my-repo repository (fetches an authorization token from CodeArtifact using your AWS credentials):
aws codeartifact login –tool npm –repository my-repo –domain my-domain

7) Use the npm CLI to install an npm package. For example, to install the popular npm package express, use the following command, if we don’t specify a version, this command will install the latest version available in the external repo:
npm install express

(express is a Node.js web application framework used to develop web and mobile applications)

8) View the package you just installed in your my-repo repository:
aws codeartifact list-packages –domain my-domain –repository my-repo

Once all above command completes successfully we can go and check in console our newly created domains and repository should be present there.

DOMAINS

REPOSITORIES

Leave a Reply