Skip to content

Commit

Permalink
UPDATE cross-region replication with delete_marker_replication disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ramesh-maddegoda committed Sep 4, 2024
1 parent adfaf90 commit c3c693f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
29 changes: 26 additions & 3 deletions terraform/terraform-modules/archive/archive.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,43 @@ resource "aws_s3_bucket_replication_configuration" "pds_nucleus_s3_bucket_replic

count = length(var.pds_node_names)

# Must have bucket versioning enabled first
depends_on = [aws_s3_bucket_versioning.pds_nucleus_hot_archive]

role = aws_iam_role.pds_nucleus_archive_replication_role.arn
bucket = aws_s3_bucket.pds_nucleus_hot_archive[count.index].id

rule {

filter {
}

id = "pds-nucleus-replication-rule-${var.pds_node_names[count.index]}"

status = "Enabled"

delete_marker_replication {
status = "Disabled"
}

destination {
bucket = var.pds_nucleus_cold_archive_buckets[count.index].arn
storage_class = var.pds_nucleus_cold_archive_storage_class

metrics {
event_threshold {
minutes = 15
}
status = "Enabled"
}


replication_time {
status = "Enabled"
time {
minutes = 15
}
}

}
}

depends_on = [aws_s3_bucket_versioning.pds_nucleus_hot_archive]
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@ then
echo "Archiving files to hot archive: $hot_archive_target_location"
aws s3 cp "$s3_url_of_file" "$hot_archive_target_location"

cold_archive_bucket_name="s3://$COLD_ARCHIVE_S3_BUCKET_NAME/"
cold_archive_target_location="${s3_url_of_file//$staging_bucket_name/$cold_archive_bucket_name}"
echo "Archiving files to cold archive: $cold_archive_target_location"
aws s3 cp "$s3_url_of_file" "$cold_archive_target_location" --storage-class GLACIER --force-glacier-transfer
# Archiving files to hot archive will also add files to cold archive with the help of S3 replication

done < "$filename"

Expand Down

0 comments on commit c3c693f

Please sign in to comment.