DEV Community

Install of Packages with NPM-Store Using AWS CodeArtifact

“ I have checked the documents of AWS to install of packages with npm-store using aws codeartifact. AWS CodeArtifact makes developer tasks easy to get the package installed and stored in the repository easily. In terms of cost, the solution is cheaper and secure.”

Aws CodeArtifact is a secure, highly scalable, managed artifact repository service that helps organizations to store and share software packages for application development. You can use codeartifact with popular build tools and package managers such as the nuget cli, maven, gradle, npm, pip, yarn and twine. CodeArtifact helps reduce the need for you to manage your own artifact storage system or worry about scaling its infrastructure. There are no limits on the number or total size of the packages that you can store in a codeartifact repository.

You can create a connection between your private codeartifact repository and an external, public repo such as npmjs.com or maven central. CodeArtifact will then fetch and store packages on demand from the public repo when they are requested by a package manager. This makes it more convenient to consume open source dependencies used by your application and helps ensure they are always available for builds and development.

In this post, you will experience the install of packages with npm-store using aws codeartifact. Here I have created an ec2 instance, iam role with access key and aws codeartifact domain with repository.

Prerequisites

You’ll need an Amazon EC2 for this post. Getting started with Amazon EC2 provides instructions on how to create an ec2 instance.

You’ll need an AWS Identity and Access Management for this post. Getting started with AWS Identity and Access Management provides instructions on how to create iam role with an access key.

Architecture Overview

Image description
The architecture diagram shows the overall deployment architecture with data flow, aws codeartifact, iam role and ec2 instance.

Solution overview

The blog post consists of the following phases:

  1. Create a AWS CodeArtifact with NPM-Store
  2. Output of Lodash Package Installed in CodeArtifact Repository Using NPM Command

I have a ec2 instance created and a iam role created with access key →

Image description

Image description

Phase 1: Create a AWS CodeArtifact with NPM-Store

  1. Open the aws codeartifact console, create a repository named “ca-demo” with npm-store option. Choose aws account, give domain name and choose aws managed key. Review and create the repository. Also connect to the repository using cli.

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Phase 2: Output of Lodash Package Installed in CodeArtifact Repository Using NPM Command

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Clean-up

AWS codeartifact, iam role and ec2 instance.

Pricing

I review the pricing and estimated cost of this example.

Cost of Amazon Elastic Compute Cloud = $(0.0116x0.435) = $0.01

Cost of AWS CodeArtifact (Per Request + Per GB Storage) = $((110 requests x 0.0)+(0GB x 0.0)) = $0.0

Total Cost = $0.01

Summary

In this post, I showed “how to install of packages with npm-store using aws codeartifact”.

For more details on AWS CodeArtifact, Checkout Get started AWS CodeArtifact, open the AWS CodeArtifact console. To learn more, read the AWS CodeArtifact documentation.

Thanks for reading!

Connect with me: Linkedin
Image description

Top comments (0)