@cloudcomponents/cdk-codecommit-backup
Backup CodeCommit repositories to S3
Install
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-codecommit-backup
Python:
pip install cloudcomponents.cdk-codecommit-backup
How to use
import { BackupBucket, S3CodeCommitBackup } from '@cloudcomponents/cdk-codecommit-backup';
import { Duration, Stack, StackProps } from 'aws-cdk-lib';
import { Repository } from 'aws-cdk-lib/aws-codecommit';
import { Schedule } from 'aws-cdk-lib/aws-events';
import { SnsTopic } from 'aws-cdk-lib/aws-events-targets';
import { Topic } from 'aws-cdk-lib/aws-sns';
import { EmailSubscription } from 'aws-cdk-lib/aws-sns-subscriptions';
import { Construct } from 'constructs';
export class CodeCommitBackupStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
if (typeof process.env.REPOSITORY_NAME === 'undefined') {
throw new Error('environment variable REPOSITORY_NAME undefined');
}
const repository = Repository.fromRepositoryName(this, 'Repository', process.env.REPOSITORY_NAME);
const backupBucket = new BackupBucket(this, 'BackupBuckt', {
retentionPeriod: Duration.days(90),
});
// The following example runs a task every day at 4am
const backup = new S3CodeCommitBackup(this, 'S3CodeCommitBackup', {
backupBucket,
repository,
schedule: Schedule.cron({
minute: '0',
hour: '4',
}),
});
const backupTopic = new Topic(this, 'BackupTopic');
if (process.env.DEVSECOPS_TEAM_EMAIL) {
backupTopic.addSubscription(new EmailSubscription(process.env.DEVSECOPS_TEAM_EMAIL));
}
backup.onBackupStarted('started', {
target: new SnsTopic(backupTopic),
});
backup.onBackupSucceeded('succeeded', {
target: new SnsTopic(backupTopic),
});
backup.onBackupFailed('failed', {
target: new SnsTopic(backupTopic),
});
}
}
API Reference
See API.md.
Example
See more complete examples.
License
Metadata
Release files for cloudcomponents.cdk-codecommit-backup 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cloudcomponents.cdk-codecommit-backup-2.2.0.tar.gz | 148.5 kB | Without provenance | Details for cloudcomponents.cdk-codecommit-backup-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cloudcomponents.cdk_codecommit_backup-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for cloudcomponents.cdk_codecommit_backup-2.2.0-py3-none-any.whl |
Total release size: 295.4 kB
Release files / cloudcomponents.cdk-codecommit-backup-2.2.0.tar.gz
| Download URL | cloudcomponents.cdk-codecommit-backup-2.2.0.tar.gz |
|---|---|
| Size | 148.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b3657d0c6bfc176f54c1d7bd0735ccd0f64bfd8e4ac24db666cf9d9a5dad07e
|
|
BLAKE2b-256 checksum How to use checksums |
c7ab5adb75168955167530c470008abf63b841ab866010df29af16f8c5c7a6e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / cloudcomponents.cdk_codecommit_backup-2.2.0-py3-none-any.whl
| Download URL | cloudcomponents.cdk_codecommit_backup-2.2.0-py3-none-any.whl |
|---|---|
| Size | 146.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e943d502ee4d4ef1232a4a108b52c16344a8834739f66e82ccfc763f5332aa8
|
|
BLAKE2b-256 checksum How to use checksums |
b694ffad4da39c96bb1ffb0b89a272b29a8cd8f24a57f1987ec728d66024778e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for cloudcomponents.cdk-codecommit-backup 2.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.