@cryptotaxi247 / infra-1 / commits / 4cbc5742

cache: add parquet inventory (#290)

This makes it cheaper to traverse and analyse the S3 list of files.

Jonas Chevalier committed Oct 20, 2023 at 13:53 UTC 4cbc57420796f1e4c4be342428f913c7f824cb3f
1 file changed +43
terraform/cache_inventory.tf new
+43
@@ -0,0 +1,43 @@
1 +# Get the list of files from the cache
2 +resource "aws_s3_bucket" "cache_inventory" {
3 + provider = aws.us
4 + bucket = "nix-cache-inventory"
5 +
6 + lifecycle_rule {
7 + enabled = true
8 +
9 + # Only keep the last 30 days
10 + expiration {
11 + days = 30
12 + }
13 + }
14 +}
15 +
16 +resource "aws_s3_bucket_inventory" "cache_inventory" {
17 + provider = aws.us
18 +
19 + bucket = aws_s3_bucket.cache.id
20 + name = "nix-cache-inventory"
21 +
22 + included_object_versions = "Current"
23 +
24 + optional_fields = [
25 + "ETag",
26 + "LastModifiedDate",
27 + "Size",
28 + "StorageClass",
29 + ]
30 +
31 + schedule {
32 + frequency = "Daily"
33 + }
34 +
35 + destination {
36 + bucket {
37 + account_id = "080433136561"
38 + format = "Parquet"
39 + bucket_arn = aws_s3_bucket.cache_inventory.arn
40 + }
41 + }
42 +}
43 +