Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
feat: expire artifacts in bucket to avoid cost accumulation
Browse files Browse the repository at this point in the history
  • Loading branch information
eoinsha committed Oct 2, 2023
1 parent 53080a5 commit 5ba9780
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/cicd/stacks/pipeline-stack.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stack, StackProps } from 'aws-cdk-lib'
import { Duration, Stack, StackProps } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import * as iam from 'aws-cdk-lib/aws-iam'
import * as codeBuild from 'aws-cdk-lib/aws-codebuild'
Expand Down Expand Up @@ -33,7 +33,17 @@ export class PipelineStack extends Stack {

const artifactBucket = new s3.Bucket(this, 'ArtifactBucket', {
encryption: s3.BucketEncryption.S3_MANAGED,
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
lifecycleRules: [{
abortIncompleteMultipartUploadAfter: Duration.days(5),
expiration: Duration.days(90),
transitions: [
{
storageClass: s3.StorageClass.INFREQUENT_ACCESS,
transitionAfter: Duration.days(30),
}
]
}]
})

const pipeline = new codePipeline.Pipeline(this, `pipeline_${lastStage}`, {
Expand Down

0 comments on commit 5ba9780

Please sign in to comment.