Skip to content

Commit

Permalink
feat(lambda): set s3 lifecycle rules for object expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardobridge committed Jan 19, 2024
1 parent 46fd000 commit 48c76f9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/artillery/lib/platform/aws-lambda/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ class PlatformLambda {
platformConfig['lambda-role-arn'] || platformConfig['lambdaRoleArn'];

this.platformOpts = platformOpts;
this.s3LifecycleConfigurationRules = [
{
Expiration: { Days: 2 },
Filter: { Prefix: '/lambda' },
ID: 'RemoveAdHocTestData',
Status: 'Enabled'
},
{
Expiration: { Days: 7 },
Filter: { Prefix: '/' },
ID: 'RemoveTestRunMetadata',
Status: 'Enabled'
}
];

this.artilleryArgs = [];
}
Expand Down Expand Up @@ -314,7 +328,10 @@ class PlatformLambda {
await this.createZip(dirname, zipfile);

artillery.log('Preparing AWS environment...');
const bucketName = await ensureS3BucketExists(this.region);
const bucketName = await ensureS3BucketExists(
this.region,
this.s3LifecycleConfigurationRules
);
this.bucketName = bucketName;

const s3path = await this.uploadLambdaZip(bucketName, zipfile);
Expand Down

0 comments on commit 48c76f9

Please sign in to comment.