Backup CodeCommit repositories to S3
Project description
@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
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.core import Construct, Stack, StackProps, Duration
from aws_cdk.aws_codecommit import Repository
from aws_cdk.aws_events import Schedule
from aws_cdk.aws_events_targets import SnsTopic
from aws_cdk.aws_sns import Topic
from aws_cdk.aws_sns_subscriptions import EmailSubscription
from cloudcomponents.cdk_codecommit_backup import BackupBucket, S3CodeCommitBackup
class CodeCommitBackupStack(Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection)
repository = Repository.from_repository_name(self, "Repository", process.env.REPOSITORY_NAME)
backup_bucket = BackupBucket(self, "BackupBuckt",
retention_period=Duration.days(90)
)
# The following example runs a task every day at 4am
backup = S3CodeCommitBackup(self, "S3CodeCommitBackup",
backup_bucket=backup_bucket,
repository=repository,
schedule=Schedule.cron(
minute="0",
hour="4"
)
)
backup_topic = Topic(self, "BackupTopic")
backup_topic.add_subscription(
EmailSubscription(process.env.DEVSECOPS_TEAM_EMAIL))
backup.on_backup_started("started",
target=SnsTopic(backup_topic)
)
backup.on_backup_succeeded("succeeded",
target=SnsTopic(backup_topic)
)
backup.on_backup_failed("failed",
target=SnsTopic(backup_topic)
)
API Reference
See API.md.
Example
See more complete examples.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cloudcomponents.cdk-codecommit-backup-1.0.38.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76bda7a60dbae2b6fbfaebdf9a832a9d72918f247ae59054b237e93c43dba61d |
|
MD5 | c6ecb62ef03a89d59960bd236c8774f2 |
|
BLAKE2b-256 | 51974bd92c74010500a98c7436eb5e7bbaac0b38312ea3b3c70d82ba5fb877db |
Close
Hashes for cloudcomponents.cdk_codecommit_backup-1.0.38-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0711ee65ae40f9788dddc784b3595a371744910ad84fc6fc7354af67db541339 |
|
MD5 | 90c5ba9ec99cbf62fe2c207646ed76f3 |
|
BLAKE2b-256 | 6f4f5dbe56c1bfdaae3ea272a6742f4f32af9e4af53664568f22a0ecd9010ae7 |