Skip to content

Commit

Permalink
add CDK nag for fmops
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonLuttenberger committed Mar 7, 2024
1 parent 1d3f733 commit f39ca02
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions modules/fmops/sagemaker-jumpstart-fm-endpoint/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "source-map-support/register";
import * as cdk from "aws-cdk-lib";
import * as cdk_nag from "cdk-nag";
import { SagemakerJumpStartFmEndpointStack } from "./lib/sagemaker-jumpstart-fm-endpoint-stack";

const account = process.env.CDK_DEFAULT_ACCOUNT;
Expand Down Expand Up @@ -35,4 +36,6 @@ new cdk.CfnOutput(stack, "metadata", {
}),
});

cdk.Aspects.of(app).add(new cdk_nag.AwsSolutionsChecks({ logIgnores: true }));

app.synth();
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SageMakerInstanceType,
JumpStartSageMakerEndpoint,
} from "@cdklabs/generative-ai-cdk-constructs";
import * as cdk_nag from "cdk-nag";

interface SagemakerJumpStartFmEndpointStackProps extends cdk.StackProps {
projectName?: string;
Expand Down Expand Up @@ -91,5 +92,12 @@ export class SagemakerJumpStartFmEndpointStack extends cdk.Stack {
role: this.role,
vpcConfig: vpcConfig,
});

cdk_nag.NagSuppressions.addResourceSuppressions(this.role, [
{
id: "AwsSolutions-IAM5",
reason: "Resource access restriced to S3 buckets (with a prefix) and ECR images",
},
]);
}
}
13 changes: 7 additions & 6 deletions modules/fmops/sagemaker-jumpstart-fm-endpoint/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions modules/fmops/sagemaker-jumpstart-fm-endpoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@types/jest": "^29.5.5",
"@types/node": "20.7.1",
"aws-cdk": "2.130.0",
"cdk-nag": "^2.28.55",
"cypress": "^13.6.1",
"jest": "^29.7.0",
"prettier": "^3.1.1",
Expand Down

0 comments on commit f39ca02

Please sign in to comment.