Skip to content

Instantly share code, notes, and snippets.

@qtangs
Last active July 30, 2019 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qtangs/3284b3c30d30aa0718f37bfd86948c0a to your computer and use it in GitHub Desktop.
Save qtangs/3284b3c30d30aa0718f37bfd86948c0a to your computer and use it in GitHub Desktop.
# iam_sagemaker.tf
resource "aws_iam_role" "sm_notebook_instance_role" {
name = "sm-notebook-instance-role"
...
}
resource "aws_iam_policy" "sm_notebook_instance_policy" {
name = "sm-notebook-instance-policy"
description = "Policy for the Notebook Instance to manage training jobs, models and endpoints"
...
}
resource "aws_iam_role_policy_attachment" "sm_notebook_instance" {
role = "${aws_iam_role.sm_notebook_instance_role.name}"
policy_arn = "${aws_iam_policy.sm_notebook_instance_policy.arn}"
}
# sagemaker.tf
resource "aws_sagemaker_notebook_instance" "basic" {
name = "FraudDetectionNotebookInstance"
role_arn = "${aws_iam_role.sm_notebook_instance_role.arn}"
instance_type = "ml.t2.medium"
...
}
# s3_lambda.tf
resource "aws_s3_bucket" "fraud_detection_function_bucket" {
bucket = "${var.function_bucket_name}-${var.aws_region}"
acl = "private"
...
}
# s3_sagemaker.tf
resource "aws_s3_bucket" "s3_bucket_1" {
bucket = "${var.s3_bucket_name_1}-${var.aws_region}"
acl = "private"
}
resource "aws_s3_bucket_object" "s3_fraud_detection_notebook" {
bucket = "${aws_s3_bucket.fraud_detection_function_bucket.id}"
key = "fraud-detection-using-machine-learning/${var.function_version}/notebooks/sagemaker_fraud_detection.ipynb"
source = "${path.module}/../source/notebooks/sagemaker_fraud_detection.ipynb"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment