AWS S3 (and Cloudflare R2) provider for Rock Remote Build Cache
npm install @rock-js/provider-s3AWS S3 remote cache provider for Rock. This package is part of the Rock ecosystem.
- Compatible with AWS S3 and Cloudflare R2
- Supports custom endpoints for self-hosted S3-compatible storage
- Secure credential handling
The provider accepts the following configuration options:
``typescript`
type ProviderConfig = {
/**
* Optional endpoint, necessary for self-hosted S3 servers or Cloudflare R2 integration
*/
endpoint?: string;
/**
* The bucket name to use for the S3 server
*/
bucket: string;
/**
* The region of the S3 server
*/
region: string;
/**
* The access key ID for the S3 server
*/
accessKeyId: string;
/**
* The secret access key for the S3 server
*/
secretAccessKey: string;
/**
* The directory to store artifacts in the S3 server.
*/
directory?: string;
/**
* The display name of the provider
*/
name?: string;
/**
* The time in seconds for the presigned URL to expire. By default, it is 24 hours.
*/
linkExpirationTime?: number;
/**
* If true, the provider will not sign requests and will try to access the S3 bucket without authentication.
*/
publicAccess?: boolean;
/**
* ACL (Access Control List) to use for uploaded objects
*/
acl?: clientS3.ObjectCannedACL;
};
`ts
// rock.config.mjs
import { providerS3 } from '@rock-js/provider-s3';
export default {
// ...
remoteCacheProvider: providerS3({
bucket: 'your-bucket',
region: 'your-region',
accessKeyId: 'access-key',
secretAccessKey: 'secret-key',
}),
};
`
`ts
// rock.config.mjs
import { providerS3 } from '@rock-js/provider-s3';
export default {
// ...
remoteCacheProvider: providerS3({
name: 'R2' // optional to display R2 instead of S3
endpoint: 'https://${ACCOUNT_ID}.r2.cloudflarestorage.com',
bucket: 'your-bucket',
region: 'your-region',
accessKeyId: 'access-key',
secretAccessKey: 'secret-key',
}),
};
`
`ts
// rock.config.mjs
import { providerS3 } from '@rock-js/provider-s3';
export default {
// ...
remoteCacheProvider: providerS3({
bucket: 'your-public-bucket',
region: 'your-region',
publicAccess: true, // Access public bucket without authentication
}),
};
``
For detailed documentation about Rock and its tools, visit Rock Documentation