Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backup_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ zipfile="${codecommitrepo}_backup_${dt}_UTC.tar.gz"
echo "Compressing repository: ${codecommitrepo} into file: ${zipfile} and uploading to S3 bucket: ${backup_s3_bucket}/${codecommitrepo}"

tar -zcvf "${zipfile}" "${codecommitrepo}/"
aws s3 cp "${zipfile}" "s3://${backup_s3_bucket}/${codecommitrepo}/${zipfile}" --region $AWS_DEFAULT_REGION
aws s3 cp "${zipfile}" "s3://${backup_s3_bucket}/${codecommitrepo}/${zipfile}" --region "$AWS_DEFAULT_REGION"

4 changes: 2 additions & 2 deletions codecommit_backup_cfn_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Resources:
Properties:
FunctionName: CodeCommitBackupLambda
Handler: codecommit_backup_trigger_lambda.handler
Runtime: python3.6
Runtime: python3.9
MemorySize: 128
Timeout: 30
Role: !GetAtt CodeCommitBackupLambdaRole.Arn
Expand Down Expand Up @@ -160,7 +160,7 @@ Resources:
Environment:
Type: LINUX_CONTAINER
ComputeType: BUILD_GENERAL1_MEDIUM
Image: aws/codebuild/python:3.5.2
Image: aws/codebuild/standard:6.0-23.02.16
EnvironmentVariables:
-
Name: CodeCommitBackupsS3Bucket
Expand Down
14 changes: 10 additions & 4 deletions codecommit_backup_trigger_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
# SPDX-License-Identifier: MIT-0

import boto3
client = boto3.client('codebuild')
def handler(event, context):
response = client.start_build(projectName='CodeCommitBackup')
output = "Triggered CodeBuild project: 'CodeCommitBackup' to back all CodeCommit repos in this account/region. Status={}".format(response["build"]["buildStatus"])

client = boto3.client("codebuild")


def handler(event, context):
response = client.start_build(projectName="CodeCommitBackup")
output = (
"Triggered CodeBuild project: 'CodeCommitBackup' to back"
" all CodeCommit repos in this account/region. Status={}"
).format(response["build"]["buildStatus"])
print(output)
return output
1 change: 0 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ stack_name="codecommit-backups"

# You can also change these parameters but it's not required
cfn_template="codecommit_backup_cfn_template.yaml"
cfn_parameters="codecommit_backup_cfn_parameters.json"
zipfile="codecommit_backup_scripts.zip"
cfn_gen_template="/tmp/gen_codecommit_backup_cfn_template.yaml"

Expand Down