- Creates a user with minimal priviledge to
- create training jobs
- create models
- deploy models as a sagemaker endpoint
- invoke model endpoints
- Creates a role with minimal priviledge for training jobs to
- retrieve a dataset from a s3 bucket with "sagemaker" in its name
- output model artifacts to an s3 bucket with "sagemaker" in its name
To use this,
- Clone the repo and follow the setup instrustions for CDK.
- Strengthen the IAM policies as you see fit in
/policies/sagemaker
(will work as is) - Run
cdk synth && cdk deploy
- The previous command will ouput in the console
brev-iam-maker.accesskeyid
=> aws_access_key_idbrev-iam-maker.secretaccesskey
=> aws_secret_access_keybrev-iam-maker.iamrole
=> training role name
Read more about aws cdk here
This project is set up like a standard Python project. The initialization
process also creates a virtualenv within this project, stored under the .env
directory. To create the virtualenv it assumes that there is a python3
(or python
for Windows) executable in your path with access to the venv
package.
To create a virtualenv on MacOS and Linux:
$ python3 -m venv .env
After the init process completes and the virtualenv is created, you can use the following step to activate your virtualenv.
$ source .env/bin/activate
If you are a Windows platform, you would activate the virtualenv like this:
% .env\Scripts\activate.bat
Once the virtualenv is activated, you can install the required dependencies.
$ pip install -r requirements.txt
At this point you can now synthesize the CloudFormation template for this code.
$ cdk synth
Next deploy the CloudFormation and show the resulting outputs.
$ cdk deploy
cdk ls
list all stacks in the appcdk synth
emits the synthesized CloudFormation templatecdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk docs
open CDK documentation
Enjoy!