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, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
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.12.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48f23fb9fc5b5e4925bfd9e99ef1cb14a9972bd3854c98930342937a7fc4bcb0 |
|
MD5 | 003ff47dda5aa69419b1f358c880b42b |
|
BLAKE2b-256 | 11be876d1d87ddefcfea6075f66b4c7f761fd2ad4eadf93b1cbe5f5723d380ff |
Close
Hashes for cloudcomponents.cdk_codecommit_backup-1.12.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36356bf375650427f85e9baf6db813430dd77e9ec15319185f4d6b045bf112e1 |
|
MD5 | 6e230a306ec7866e07ed46478f5e9cc3 |
|
BLAKE2b-256 | 4635afbdba1e56bf7416fb7c52f2ccb244d95d9fd0a5864565b1ad34e23b2ab3 |