generated from linz/template-javascript-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Configure basic Hydro survey stack
Uses human-friendly bucket names with an account suffix only in non-production accounts.
- Loading branch information
Showing
6 changed files
with
173 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@linz:registry=https://npm.pkg.github.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,49 @@ | ||
import { Stack, StackProps } from 'aws-cdk-lib'; | ||
import { Duration, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; | ||
import { Bucket, StorageClass } from 'aws-cdk-lib/aws-s3'; | ||
import { Construct } from 'constructs'; | ||
// import * as sqs from 'aws-cdk-lib/aws-sqs'; | ||
import { AwsAccounts } from '@linz/accounts'; | ||
import { LinzAccountName } from '@linz/accounts/dist/aws.account.name'; | ||
|
||
export const surveyLandingZoneBucketLogicalId = 'SurveyLandingZone'; | ||
export const surveyProcessingBucketLogicalId = 'SurveyProcessing'; | ||
export const surveyPublicationsBucketLogicalId = 'SurveyPublications'; | ||
|
||
export class HydroSurveyStack extends Stack { | ||
constructor(scope: Construct, id: string, props?: StackProps) { | ||
super(scope, id, props); | ||
|
||
// The code that defines your stack goes here | ||
let bucketNameSuffix = ''; | ||
if (props?.env?.account !== AwsAccounts.byNameProd(LinzAccountName.HydroSurveys).id) { | ||
bucketNameSuffix = `-${props?.env?.account}`; | ||
} | ||
|
||
// example resource | ||
// const queue = new sqs.Queue(this, 'HydroSurveyQueue', { | ||
// visibilityTimeout: cdk.Duration.seconds(300) | ||
// }); | ||
new Bucket(this, surveyLandingZoneBucketLogicalId, { | ||
bucketName: `ttwlinz-hydro-survey-landing-zone${bucketNameSuffix}`, | ||
removalPolicy: RemovalPolicy.RETAIN, | ||
}); | ||
new Bucket(this, surveyProcessingBucketLogicalId, { | ||
bucketName: `ttwlinz-hydro-survey-processing${bucketNameSuffix}`, | ||
removalPolicy: RemovalPolicy.RETAIN, | ||
versioned: true, | ||
}); | ||
new Bucket(this, surveyPublicationsBucketLogicalId, { | ||
bucketName: `ttwlinz-hydro-survey-publications${bucketNameSuffix}`, | ||
lifecycleRules: [ | ||
{ | ||
transitions: [ | ||
{ | ||
storageClass: StorageClass.INFREQUENT_ACCESS, | ||
transitionAfter: Duration.days(365), | ||
}, | ||
{ | ||
storageClass: StorageClass.GLACIER, | ||
transitionAfter: Duration.days(8 * 365), | ||
}, | ||
], | ||
}, | ||
], | ||
removalPolicy: RemovalPolicy.RETAIN, | ||
versioned: true, | ||
}); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters