Skip to content

Commit cdb5efd

Browse files
authored
Merge pull request #1622 from guardian/import-event-consumer-s3-bucket
Import event consumer s3 bucket
2 parents 66e98f1 + f07995b commit cdb5efd

2 files changed

Lines changed: 83 additions & 1 deletion

File tree

cdk/lib/__snapshots__/report.test.ts.snap

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,44 @@ exports[`The Report stack matches the snapshot for CODE 1`] = `
325325
},
326326
"Type": "AWS::IAM::Policy",
327327
},
328+
"EventConsumerBucketE6EE7609": {
329+
"DeletionPolicy": "Retain",
330+
"Properties": {
331+
"BucketName": "aws-mobile-event-logs-code",
332+
"LifecycleConfiguration": {
333+
"Rules": [
334+
{
335+
"ExpirationInDays": 21,
336+
"Status": "Enabled",
337+
},
338+
],
339+
},
340+
"Tags": [
341+
{
342+
"Key": "App",
343+
"Value": "report",
344+
},
345+
{
346+
"Key": "gu:cdk:version",
347+
"Value": "TEST",
348+
},
349+
{
350+
"Key": "gu:repo",
351+
"Value": "guardian/mobile-n10n",
352+
},
353+
{
354+
"Key": "Stack",
355+
"Value": "mobile-notifications",
356+
},
357+
{
358+
"Key": "Stage",
359+
"Value": "CODE",
360+
},
361+
],
362+
},
363+
"Type": "AWS::S3::Bucket",
364+
"UpdateReplacePolicy": "Retain",
365+
},
328366
"GetDistributablePolicyReportA81F1F70": {
329367
"Properties": {
330368
"PolicyDocument": {
@@ -1591,6 +1629,44 @@ exports[`The Report stack matches the snapshot for PROD 1`] = `
15911629
},
15921630
"Type": "AWS::IAM::Policy",
15931631
},
1632+
"EventConsumerBucketE6EE7609": {
1633+
"DeletionPolicy": "Retain",
1634+
"Properties": {
1635+
"BucketName": "aws-mobile-event-logs-prod",
1636+
"LifecycleConfiguration": {
1637+
"Rules": [
1638+
{
1639+
"ExpirationInDays": 21,
1640+
"Status": "Enabled",
1641+
},
1642+
],
1643+
},
1644+
"Tags": [
1645+
{
1646+
"Key": "App",
1647+
"Value": "report",
1648+
},
1649+
{
1650+
"Key": "gu:cdk:version",
1651+
"Value": "TEST",
1652+
},
1653+
{
1654+
"Key": "gu:repo",
1655+
"Value": "guardian/mobile-n10n",
1656+
},
1657+
{
1658+
"Key": "Stack",
1659+
"Value": "mobile-notifications",
1660+
},
1661+
{
1662+
"Key": "Stage",
1663+
"Value": "PROD",
1664+
},
1665+
],
1666+
},
1667+
"Type": "AWS::S3::Bucket",
1668+
"UpdateReplacePolicy": "Retain",
1669+
},
15941670
"GetDistributablePolicyReportA81F1F70": {
15951671
"Properties": {
15961672
"PolicyDocument": {

cdk/lib/report.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { GuStack } from '@guardian/cdk/lib/constructs/core';
77
import { GuCname } from '@guardian/cdk/lib/constructs/dns';
88
import { GuAllowPolicy } from '@guardian/cdk/lib/constructs/iam';
99
import type { App } from 'aws-cdk-lib';
10-
import { Duration } from 'aws-cdk-lib';
10+
import { Duration, RemovalPolicy } from 'aws-cdk-lib';
1111
import type { CfnAutoScalingGroup } from 'aws-cdk-lib/aws-autoscaling';
1212
import { Table } from 'aws-cdk-lib/aws-dynamodb';
1313
import { InstanceClass, InstanceSize, InstanceType } from 'aws-cdk-lib/aws-ec2';
@@ -188,5 +188,11 @@ export class Report extends GuStack {
188188
],
189189
}),
190190
);
191+
192+
new Bucket(this, 'EventConsumerBucket', {
193+
bucketName: `aws-mobile-event-logs-${stage.toLowerCase()}`,
194+
removalPolicy: RemovalPolicy.RETAIN,
195+
lifecycleRules: [{ expiration: Duration.days(21), enabled: true }],
196+
});
191197
}
192198
}

0 commit comments

Comments
 (0)