From c0ae6445108caf0208248156abb71d72c57ceb7c Mon Sep 17 00:00:00 2001 From: Andreas Wittig Date: Wed, 31 Jan 2024 11:09:17 +0100 Subject: [PATCH] Adding parameter to configure DB backup retention period --- .github/workflows/deploy.yml | 2 +- mastodon.yaml | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7c74919..6fc2460 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,4 +37,4 @@ jobs: VAPID_PUBLIC_KEY=$(aws ssm get-parameter --name /mastodon/prod/vapid_public_key --with-decryption --query Parameter.Value --output text) ALERTING_HTTPS_ENDPOINT=$(aws ssm get-parameter --name /mastodon/prod/alerting_https_endpoint --with-decryption --query Parameter.Value --output text) aws cloudformation package --template-file mastodon.yaml --s3-bucket cloudformation-widdix-mastodon --output-template-file packaged.yml - aws cloudformation deploy --template-file packaged.yml --stack-name cloudonaut-mastodon --capabilities CAPABILITY_IAM --parameter-overrides "DomainName=${DOMAIN_NAME}" "SecretKeyBase=${SECRET_KEY_BASE}" "OtpSecret=${OTP_SECRET}" "VapidPrivateKey=${VAPID_PRIVATE_KEY}" "VapidPublicKey=${VAPID_PUBLIC_KEY}" "AlertingHttpsEndpoint=${ALERTING_HTTPS_ENDPOINT}" "Spot=true" "DatabaseAllocatedStorage=10" "ContainerInsights=disabled" + aws cloudformation deploy --template-file packaged.yml --stack-name cloudonaut-mastodon --capabilities CAPABILITY_IAM --parameter-overrides "DomainName=${DOMAIN_NAME}" "SecretKeyBase=${SECRET_KEY_BASE}" "OtpSecret=${OTP_SECRET}" "VapidPrivateKey=${VAPID_PRIVATE_KEY}" "VapidPublicKey=${VAPID_PUBLIC_KEY}" "AlertingHttpsEndpoint=${ALERTING_HTTPS_ENDPOINT}" "Spot=true" "DatabaseAllocatedStorage=10" "ContainerInsights=disabled DatabaseBackupRetentionPeriod=14" diff --git a/mastodon.yaml b/mastodon.yaml index f729d7b..5afc2c9 100644 --- a/mastodon.yaml +++ b/mastodon.yaml @@ -43,6 +43,10 @@ Parameters: Type: String Default: enabled AllowedValues: [enabled, disabled] + DatabaseBackupRetentionPeriod: + Description: 'Number of days to keep automated snapshots' + Type: Number + Default: 30 Resources: Alerting: Type: 'AWS::CloudFormation::Stack' @@ -134,7 +138,7 @@ Resources: DBAllocatedStorage: !Ref DatabaseAllocatedStorage DBInstanceClass: 'db.t4g.micro' DBName: 'mastodon' - DBBackupRetentionPeriod: '30' + DBBackupRetentionPeriod: !Ref DatabaseBackupRetentionPeriod DBMasterUsername: 'mastodon' DBMultiAZ: 'false' EngineVersion: '14.5'