Using S3
Section titled “Using S3”Once binaries are pushed to S3 and package index files are created, you can use them with install.packages()
and alikes. When setting the repository, provide the URL to the directory containing the package index files (e.g., PACKAGES
):
install.packages(<pkg>, repo = "https://<s3 url>/")# Example# install.packages("brew", repo = "https://cran.rpkgs.com/arm64/noble/latest")
Using a Content Delivery Network (CDN)
Section titled “Using a Content Delivery Network (CDN)”Installing packages directly from S3 has some downsides:
- Files are downloaded fully for every request
- Download times increase with distance from the S3 region (and usually packages are only stored in one region)
A CDN in front of the S3 bucket solves these issues. It comes with following benefits:
- CDNs cache files from the underlying S3 source after the first request for a specific period. Subsequent requests for the same file are served from the CDN cache without querying S3. This is faster and reduces S3 request costs.
- CDNs distribute files across multiple edge nodes globally instead of serving them from a single location. Users will receive the assets from the nearest regional server and its respective local cache, reducing latency regardless of location.