Skip to content

Terraform module to deploy a Lambda function to automatically unzip files in an S3 bucket

License

Notifications You must be signed in to change notification settings

robbytaylor/terraform-aws-s3-unzip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform AWS S3 Unzip

Terraform module to deploy a Lambda function to automatically extract zip files in an S3 bucket.

By default the Lambda function is run when a file is created in the specified S3 bucket.

Examples

Extract all files in the same bucket

module s3-unzip {
  source         = "robbytaylor/s3-unzip/aws"
  version        = "0.3.0"

  dest_prefix    = "extracted/"
  dest_key       = "$zipFilename/$filename.$extension"
  src_bucket     = "files.robbytaylor.io"
  src_prefix     = "zip/"
}

Extract .js files from one bucket to another

module s3-unzip {
  source         = "robbytaylor/s3-unzip/aws"
  version        = "0.3.0"

  dest_bucket    = "js.robbytaylor.io"
  src_bucket     = "zip.robbytaylor.io"
  match_regex    = "/^[^/]+.js$/"
}

Extract .js files but rename them to match the zip filename

module s3-unzip {
  source         = "robbytaylor/s3-unzip/aws"
  version        = "0.3.0"

  dest_key       = "$zipFilename.$extension"
  src_bucket     = "code.robbytaylor.io"
  src_prefix     = "zip/"
  match_regex    = "/^[^/]+.js$/"
}

Extract all files in the same bucket, and delete the zip file after

module s3-unzip {
  source         = "robbytaylor/s3-unzip/aws"
  version        = "0.3.0"

  dest_prefix    = "extracted/"
  dest_key       = "$zipFilename/$filename.$extension"
  src_bucket     = "files.robbytaylor.io"
  src_prefix     = "zip/"

  delete_source = true
}

About

Terraform module to deploy a Lambda function to automatically unzip files in an S3 bucket

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published