Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rake task for bucket lifecycle config #917

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

BasilMawejje
Copy link

@BasilMawejje BasilMawejje commented Oct 12, 2021

PT Story: Backups: (AWS) automate keeping non-daily backups

PT URL: https://www.pivotaltracker.com/story/show/173667123

This is part of the overall story to automate AWS backups.

Changes proposed in this pull request:

  1. Add rake task for s3 bucket lifecycle config

Screenshots (Optional):

Screenshot 2021-10-12 at 19 13 48

--- ## Ready for review: @weedySeaDragon

@BasilMawejje BasilMawejje force-pushed the add-rake-task-to-set-policy-on-bucket branch from 8bcbc28 to 7097603 Compare October 12, 2021 20:23
@weedySeaDragon
Copy link
Collaborator

Just in case you haven't already figured it out,
I figured out what the 'Malformed XML...' problem was from this
aws/aws-sdk-ruby#2350

Also: We don't need to specify both the date for an action (e.g. transition, expiration) and the number of days. We're just concerned with the number of days.

This is what I was able to put successfully:

 aws_client.put_bucket_lifecycle_configuration({
                                                        bucket: aws_s3_backup_bucket_name,
                                                        lifecycle_configuration: {
                                                          rules: [
                                                            {
                                                              expiration: { days: 3650 },
                                                              id: "Transition objects to GLACIER after 90 days then move them to DEEP_ARCHIVE after 450 days",
                                                              filter: {
                                                                prefix: aws_s3_backup_bucket_full_prefix
                                                              },
                                                              status: 'Enabled',
                                                              transitions: [
                                                                { days: 90, storage_class: 'GLACIER' },
                                                                { days: 450, storage_class: 'DEEP_ARCHIVE' }
                                                              ]
                                                            }
                                                          ]
                                                        }
                                                      })

lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
@BasilMawejje BasilMawejje force-pushed the add-rake-task-to-set-policy-on-bucket branch from 019b19f to a83b442 Compare October 13, 2021 06:26
@BasilMawejje BasilMawejje changed the title WIP: Add rake task for bucket lifecycle config Add rake task for bucket lifecycle config Oct 13, 2021
@BasilMawejje BasilMawejje force-pushed the add-rake-task-to-set-policy-on-bucket branch from a83b442 to 2e47d47 Compare October 13, 2021 06:37
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
@BasilMawejje BasilMawejje force-pushed the add-rake-task-to-set-policy-on-bucket branch from e376bc9 to 6a427cb Compare October 14, 2021 17:24
Update aws-sdk gem versions to fix malformedXML error
@BasilMawejje BasilMawejje force-pushed the add-rake-task-to-set-policy-on-bucket branch from 6a427cb to 20ba3f6 Compare October 27, 2021 10:59
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
lib/tasks/shf_aws.rake Outdated Show resolved Hide resolved
@BasilMawejje BasilMawejje force-pushed the add-rake-task-to-set-policy-on-bucket branch from 378249e to ef4b0a5 Compare October 27, 2021 11:04
@BasilMawejje BasilMawejje force-pushed the add-rake-task-to-set-policy-on-bucket branch from ef4b0a5 to faa358d Compare October 27, 2021 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants