Crate lambda

Source
Expand description

Anonymiser lambda

This lambda is used to convert incoming scripts from the TRE production bucket into anonymised packages

Given the following input:

{
  "parameters": {
    "s3Bucket": "input-bucket",
    "s3Key": "TRE-TDR-2023-ABC.tar.gz"
  }
}

The lambda will:

  • Download the file from S3 to local disk
  • Anonymise it using the anonymise library
  • Upload it to S3 using the OUTPUT_BUCKET environment variable
  • Send the SQS message to the queue specified in the OUTPUT_QUEUE environment variable

Structsยง

MessageBody ๐Ÿ”’
The bucket and key for the file we are processing
S3Details ๐Ÿ”’

Functionsยง

aws_config ๐Ÿ”’
Creates an AWS SDK config object
create_s3_client ๐Ÿ”’
Creates an S3 client
create_sqs_client ๐Ÿ”’
Creates an SQS client
download ๐Ÿ”’
Downloads the specified file
process_record
Processes the SQS message.
upload ๐Ÿ”’
Uploads the specified file