Skip to main content

Backup CodeCommit repositories to S3

Project description

cloudcomponents Logo

@cloudcomponents/cdk-codecommit-backup

Build Status cdkdx typescript python Mentioned in Awesome CDK

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

MIT

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

cloudcomponents.cdk-codecommit-backup-1.38.0.tar.gz (77.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file cloudcomponents.cdk-codecommit-backup-1.38.0.tar.gz.

File metadata

  • Download URL: cloudcomponents.cdk-codecommit-backup-1.38.0.tar.gz
  • Upload date:
  • Size: 77.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.6

File hashes

Hashes for cloudcomponents.cdk-codecommit-backup-1.38.0.tar.gz
Algorithm Hash digest
SHA256 92cfb11c04fc829065cfa5ae3bee35b5febc6f122890d8e0edd756715c4a4b75
MD5 a94749f84f27efb6fe7283f5015f2a27
BLAKE2b-256 3b7cef82568b82d867b57fed026c87c1341572d16128db8e18a69c97cb1adb30

See more details on using hashes here.

File details

Details for the file cloudcomponents.cdk_codecommit_backup-1.38.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudcomponents.cdk_codecommit_backup-1.38.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d031cac88feff2d6f15143c0f227f9322703a3cc85c83b35b0064c851e56e18b
MD5 7dd4c26375051af6ac1e861032732b56
BLAKE2b-256 94ff21f28fa5bc89d572a5a652b48c12c927d0b440b6fcbd19a437fd01339687

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page