-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added a new Personas module. * fix cdk issues * Added a new Personas module. * Added a new Personas module. * Updated README.md * Completed the checklist items * mypy: add ignore for cdk default factory * housekeeping * changelog * pr comments * upd mypy conf
- Loading branch information
Showing
17 changed files
with
1,136 additions
and
25 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
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
File renamed without changes.
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,5 @@ | ||
name: personas | ||
path: modules/examples/personas | ||
parameters: | ||
- name: bucket-name | ||
value: my-bucket |
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,57 @@ | ||
# Personas Module | ||
|
||
## Description | ||
|
||
This module is an example that deploys various roles that may be required for an AI/ML project, including: | ||
|
||
- ML Engineer | ||
- Data Engineer | ||
- IT Lead | ||
- Business Analyst | ||
- MLOPs Engineer | ||
- IT Auditor | ||
- Model Risk Manager | ||
|
||
The module creates separate roles with appropriate permissions and policies for each persona, ensuring proper segregation of duties and access control within the AI/ML project. | ||
|
||
## Inputs/Outputs | ||
|
||
### Input Parameters | ||
|
||
#### Required | ||
|
||
- `bucket_name`: S3 bucket name to add permissions for | ||
|
||
## Sample manifest declaration | ||
|
||
Create a manifest file under appropriate location, for example examples/manifests | ||
``` | ||
name: personas | ||
path: modules/examples/personas | ||
parameters: | ||
- name: bucket-name | ||
value: my-bucket | ||
``` | ||
|
||
### Outputs (module metadata): | ||
- `MLEngineerRoleArn` - the arn of the Machine Learning Engineer Role | ||
- `DataEngineerRoleArn` - the arn of the Data Engineer Role | ||
- `ITLeadRoleArn` - the arn of the Machine IT Lead Role | ||
- `BusinessAnalystRoleArn` - the arn of the Business Analyst Role | ||
- `MLOpsEngineerRoleArn` - the arn of the Machine Learning Ops Engineer Role | ||
- `ITAuditorRoleArn` - the arn of the IT Auditor Role | ||
- `ModelRiskManagerRoleArn` - the arn of the Model Risk Manager Role | ||
|
||
### Example Output: | ||
```yaml | ||
metadata: | | ||
{ | ||
"MLEngineerRoleArn": "arn:aws:iam::<account_id>:role/MyStack-MLEngineerRole-<random_string>", | ||
"DataEngineerRoleArn": "arn:aws:iam::<account_id>:role/MyStack-DataEngineerRole-<random_string>", | ||
"ITLeadRoleArn": "arn:aws:iam::<account_id>:role/MyStack-ITLeadRole-<random_string>", | ||
"BusinessAnalystRoleArn": "arn:aws:iam::<account_id>:role/MyStack-BusinessAnalystRole-<random_string>", | ||
"MLOpsEngineerRoleArn": "arn:aws:iam::<account_id>:role/MyStack-MLOpsEngineerRole-<random_string>", | ||
"ITAuditorRoleArn": "arn:aws:iam::<account_id>:role/MyStack-ITAuditorRole-<random_string>", | ||
"ModelRiskManagerRoleArn": "arn:aws:iam::<account_id>:role/MyStack-ModelRiskManagerRole-<random_string>" | ||
} | ||
``` |
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,52 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import aws_cdk | ||
import cdk_nag | ||
|
||
from settings import ApplicationSettings | ||
from stack import Personas | ||
|
||
app = aws_cdk.App() | ||
# Load application settings from env vars. | ||
app_settings = ApplicationSettings() | ||
|
||
|
||
stack = Personas( | ||
scope=app, | ||
construct_id=app_settings.settings.app_prefix, | ||
app_prefix=app_settings.settings.app_prefix, | ||
bucket_name=app_settings.parameters.bucket_name, | ||
env=aws_cdk.Environment( | ||
account=app_settings.default.account, | ||
region=app_settings.default.region, | ||
), | ||
) | ||
|
||
aws_cdk.CfnOutput( | ||
scope=stack, | ||
id="metadata", | ||
value=stack.to_json_string( | ||
{ | ||
"MLEngineerRoleArn": stack.personas.ml_engineer_role.role_arn, | ||
"DataEngineerRoleArn": stack.personas.data_engineer_role.role_arn, | ||
"ITLeadRoleArn": stack.personas.it_lead_role.role_arn, | ||
"BusinessAnalystRoleArn": stack.personas.business_analyst_role.role_arn, | ||
"MLOpsEngineerRoleArn": stack.personas.mlops_engineer_role.role_arn, | ||
"ITAuditorRoleArn": stack.personas.it_auditor_role.role_arn, | ||
"ModelRiskManagerRoleArn": stack.personas.model_risk_manager_role.role_arn, | ||
} | ||
), | ||
) | ||
|
||
aws_cdk.Aspects.of(app).add(cdk_nag.AwsSolutionsChecks(log_ignores=True)) | ||
|
||
if app_settings.parameters.tags: | ||
for tag_key, tag_value in app_settings.parameters.tags.items(): | ||
aws_cdk.Tags.of(app).add(tag_key, tag_value) | ||
|
||
aws_cdk.Tags.of(app).add("SeedFarmerDeploymentName", app_settings.settings.deployment_name) | ||
aws_cdk.Tags.of(app).add("SeedFarmerModuleName", app_settings.settings.module_name) | ||
aws_cdk.Tags.of(app).add("SeedFarmerProjectName", app_settings.settings.project_name) | ||
|
||
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,22 @@ | ||
publishGenericEnvVariables: true | ||
deploy: | ||
phases: | ||
install: | ||
commands: | ||
- npm install -g [email protected] | ||
- pip install -r requirements.txt | ||
build: | ||
commands: | ||
- cdk deploy --require-approval never --progress events --app "python app.py" --outputs-file ./cdk-exports_personas.json | ||
# Export metadata | ||
- seedfarmer metadata convert -f cdk-exports_personas.json || true | ||
destroy: | ||
phases: | ||
install: | ||
commands: | ||
- npm install -g [email protected] | ||
- pip install -r requirements.txt | ||
build: | ||
commands: | ||
# execute the CDK | ||
- cdk destroy --force --app "python app.py" |
Oops, something went wrong.