in netbench-cdk/lib/netbench.ts [16:46]
constructor(scope: Construct, id: string, props?: NetbenchStackProps) {
super(scope, id, props);
this.createVPC();
this.createCloudwatchGroup();
this.createRole();
this.createMonitorLambda();
const GHAUser = this.createGHAIamUser();
// We're over-riding CF's naming scheme so this name
// must be globally unique. By default, AWSStage will be username.
if (props?.reportStack) {
let bucketName: string = "";
if (props && props.bucketSuffix) {
bucketName = `netbenchrunnerlogs-public-${props.bucketSuffix}`;
} else {
throw new Error('Unable to determine reporting bucket suffix');
}
// Create the public logs bucket
const distBucket = this.createS3Bucket(bucketName, true);
new cdk.CfnOutput(this, "output:NetbenchRunnerPublicLogsBucket", { value: distBucket.bucketName })
this.createCloudFront('CFdistribution', distBucket);
// Create the private source code bucket, without any distribution.
const srcCodeBucket = this.createS3Bucket(`netbenchrunner-private-source-${props.bucketSuffix}`, false);
new cdk.CfnOutput(this, "output:NetbenchRunnerPrivateSrcBucket", { value: srcCodeBucket.bucketName })
// Stitch together the buckets, a policy, and the GHA user
distBucket.grantReadWrite(GHAUser);
srcCodeBucket.grantReadWrite(GHAUser);
}
}