-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Karan Thanvi <karanthanvi0@gmail.com> Co-authored-by: Camillo Anania <camillo.anania@gmail.com> Co-authored-by: Aditya Chaphekar <adityachap@gmail.com> Co-authored-by: Onat Celmen <onatcelmen@me.com>
- Loading branch information
1 parent
35bb382
commit 944421c
Showing
38 changed files
with
1,469 additions
and
7 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,12 @@ | ||
*.swp | ||
package-lock.json | ||
__pycache__ | ||
.pytest_cache | ||
.venv | ||
*.egg-info | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out | ||
cdk.context.json | ||
|
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
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,71 @@ | ||
#!/usr/bin/env python3 | ||
import aws_cdk as cdk | ||
from os import getenv | ||
from infra.usage_anomaly_detector import UsageAnomalyDetectorStack | ||
from cdk_nag import AwsSolutionsChecks, NagSuppressions, NagPackSuppression | ||
|
||
app = cdk.App() | ||
usage_anomaly_detector_infra_stack = UsageAnomalyDetectorStack(app, app.node.try_get_context('stack-name'), | ||
env=cdk.Environment( | ||
region=getenv('AWS_REGION', getenv('CDK_DEFAULT_REGION')), | ||
account=getenv('AWS_ACCOUNT_ID', getenv('CDK_DEFAULT_ACCOUNT')) | ||
), | ||
description="Usage Anomaly Detector Stack uksb-1tupbocl1" | ||
) | ||
|
||
tags={ | ||
'SolutionName': 'Usage Anomaly Detector', | ||
'SolutionVersion': 'v1.0.0', | ||
'SolutionIaC': 'CDK v2' | ||
} | ||
|
||
for key, val in tags.items(): | ||
cdk.Tags.of(usage_anomaly_detector_infra_stack).add(key,val) | ||
|
||
# nag suppressions | ||
nagsuppression_checks = [ | ||
{ | ||
"rule":"AwsSolutions-L1", | ||
"reason":"Already using latest version pythnb3.9 & nodejs18.x for lambda" | ||
}, | ||
{ | ||
"rule":"AwsSolutions-IAM4", | ||
"reason": "use AWS managed policies for IAM roles for lambda & other cdk defaults" | ||
}, | ||
{ | ||
"rule":"AwsSolutions-IAM5", | ||
"reason":"use AWS managed policies from cdk defaults" | ||
}, | ||
{ | ||
"rule" : "AwsSolutions-OS1", | ||
"reason" : "using public opensearch domain for solution" | ||
}, | ||
{ | ||
"rule" : "AwsSolutions-OS3", | ||
"reason" : "using public opensearch domain for solution, IP restriction can be added by oss user." | ||
}, | ||
{ | ||
"rule" : "AwsSolutions-OS4", | ||
"reason" : "does not need dedicated master" | ||
}, | ||
{ | ||
"rule": "AwsSolutions-OS5", | ||
"reason": "using cognito for public opensearch dashboard auth" | ||
}, | ||
{ | ||
"rule": "AwsSolutions-OS9", | ||
"reason": "solution dedicated opensearch, exempting slow logs/index publish" | ||
} | ||
|
||
] | ||
for checks in nagsuppression_checks: | ||
NagSuppressions.add_stack_suppressions(usage_anomaly_detector_infra_stack, [ | ||
NagPackSuppression( | ||
id=checks['rule'], | ||
reason=checks['reason'] | ||
) | ||
]) | ||
|
||
# nag checks | ||
cdk.Aspects.of(app).add(AwsSolutionsChecks(verbose=True)) | ||
app.synth() |
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,43 @@ | ||
{ | ||
"app": "python3 app.py", | ||
"watch": { | ||
"include": [ | ||
"**" | ||
], | ||
"exclude": [ | ||
"README.md", | ||
"cdk*.json", | ||
"requirements*.txt", | ||
"source.bat", | ||
"**/__init__.py", | ||
"python/__pycache__", | ||
"tests" | ||
] | ||
}, | ||
"context": { | ||
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, | ||
"@aws-cdk/core:stackRelativeExports": true, | ||
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true, | ||
"@aws-cdk/aws-lambda:recognizeVersionProps": true, | ||
"@aws-cdk/aws-lambda:recognizeLayerVersion": true, | ||
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, | ||
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, | ||
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, | ||
"@aws-cdk/core:checkSecretUsage": true, | ||
"@aws-cdk/aws-iam:minimizePolicies": true, | ||
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, | ||
"@aws-cdk/core:validateSnapshotRemovalPolicy": true, | ||
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, | ||
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, | ||
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, | ||
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true, | ||
"@aws-cdk/core:enablePartitionLiterals": true, | ||
"@aws-cdk/customresources:installLatestAwsSdkDefault": false, | ||
"@aws-cdk/core:target-partitions": [ | ||
"aws", | ||
"aws-cn" | ||
], | ||
"stack-name": "usage-anomaly-detector-stack", | ||
"enable-lambda-trail": "true" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Oops, something went wrong.