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 from non-compiling source. May contain errors.
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.47.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9745550e1da390c0bfbb6c3dfd97fee17cb02bfac4326a706e9a837be3ada750 |
|
MD5 | 164353902793f093d4c4e26db1f97ed2 |
|
BLAKE2b-256 | 789078fa046d719f47bff58bb81b7e13719181b81f2265a0c17a3f5cbdccc6e1 |
Close
Hashes for cloudcomponents.cdk_codecommit_backup-1.47.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54a6550a40e38d3671cce00f83b25623441c9a19166f8fa99b4e951f07b19433 |
|
MD5 | bf2bcef18f8f8710ef1b16efcc6ea733 |
|
BLAKE2b-256 | 4b420846665dc9dcd58da277fcb28d3d052d22176706c97f1d92bd398118cccf |