I would like to delete the back up files that is older than 1 week. I have followed this backup document from gitlab and successfully create the backup files to upload to Amazon S3.
I have also set up gitlab_rails['backup_keep_time'] = 604800
but it does not work.
However, from what I observe in the IAM user policy they created. There is no authorization to delete the files.
The backup files are packing up and I would not want to do this manually in AWS.
Is there any standard way to delete the backup files in Amazon S3 for gitlab omnibus package?
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1412062044000",
"Effect": "Allow",
"Action": [
"s3:AbortMultipartUpload",
"s3:GetBucketAcl",
"s3:GetBucketLocation",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListBucketMultipartUploads",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::my.s3.bucket/*"
]
},
{
"Sid": "Stmt1412062097000",
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListAllMyBuckets"
],
"Resource": [
"*"
]
},
{
"Sid": "Stmt1412062128000",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my.s3.bucket"
]
}
]
}
You can use S3 lifecycle policy by Following steps:
Click on your S3 property and select Lifecycle tab and click Add rule.
Click on Configure Rule.
Check permanently delete and enter seven days(or any other number you want) and click on review.
Enter rule name and click on "create and activate rule".
Check your rule created successfully and enjoy.