Skip to content

Commit 55d44ff

Browse files
committed
Rename folders and update README
1 parent 3d46788 commit 55d44ff

27 files changed

+89
-100
lines changed

CODE_OF_CONDUCT.md

-4
This file was deleted.

CONTRIBUTING.md

-61
This file was deleted.

NOTICE

-2
This file was deleted.

README.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,48 @@
11
## Fraud Detection Using Machine Learning
22

3-
Setup end to end demo architecture for predicting fraud events with Machine Learning using Amazon SageMaker
3+
Setup end to end demo architecture for predicting fraud events with Machine Learning using `Amazon SageMaker` and `Terraform`.
4+
This repo supports the original article posted on Medium (links to be shared).
5+
6+
## Terraform version
7+
8+
Ensure your `Terraform` version is as follows (some modifications would be required if you run other `Terraform` versions):
9+
```sh
10+
$ terraform --version
11+
Terraform v0.11.14
12+
+ provider.archive v1.2.2
13+
+ provider.aws v2.21.1
14+
+ provider.template v2.1.2
15+
```
16+
To download `Terraform`, visit https://releases.hashicorp.com/terraform/
17+
18+
## Setup steps
19+
20+
From `terraform` folder:
21+
1. Copy `terraform_backend.tf.template` to `terraform_backend.tf` and modify values accordingly. You need to manually create an S3 bucket or use an existing one to store the Terraform state file.
22+
2. Copy `terraform.tfvars.template` to `terraform.tfvars` and modify values accordingly. You don't need to create any buckets specified in here, they're to be created by terraform apply.
23+
3. Run the followings:
24+
```sh
25+
export AWS_PROFILE=<your desired profile>
26+
27+
terraform init
28+
terraform validate
29+
terraform plan -out=tfplan
30+
terraform apply --auto-approve tfplan
31+
```
32+
33+
34+
## Clean up
35+
36+
```
37+
terraform plan -destroy -out=tfplan
38+
terraform apply tfplan
39+
```
40+
41+
## Original source
42+
https://github.com/awslabs/fraud-detection-using-machine-learning
43+
44+
Original CloudFormation script can be found at `cloudformation` folder (renamed from `deployment`).
45+
446

547
## License
648

File renamed without changes.
File renamed without changes.
File renamed without changes.

deployment-tf/steps.txt

-7
This file was deleted.
File renamed without changes.
File renamed without changes.

deployment-tf/iam_kinesis.tf renamed to terraform/iam_kinesis.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ resource "aws_iam_role_policy_attachment" "fraud_detection_firehose" {
2929

3030
resource "aws_iam_policy" "fraud_detection_firehose_policy" {
3131
name = "fraud-detection-firehose-policy"
32+
description = "Policy for the Amazon Kinesis Data Firehose to save data to S3 bucket"
3233
path = "/"
33-
description = "FirehoseDeliveryIAMPolicy"
3434

3535
policy = <<EOF
3636
{

deployment-tf/iam_lambda.tf renamed to terraform/iam_lambda.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ resource "aws_iam_role_policy_attachment" "fraud_detection_lambda" {
2828
}
2929

3030
resource "aws_iam_policy" "fraud_detection_lambda_policy" {
31-
name = "fraud-detection-lambda-policy"
32-
path = "/"
31+
name = "fraud-detection-lambda-policy"
32+
description = "Policy for the fraud detection function to put records into the Amazon Kinesis Data Firehose"
33+
path = "/"
3334

3435
policy = <<EOF
3536
{

deployment-tf/iam_sagemaker.tf renamed to terraform/iam_sagemaker.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ resource "aws_iam_role_policy_attachment" "sm_notebook_instance" {
3434

3535
resource "aws_iam_policy" "sm_notebook_instance_policy" {
3636
name = "sm-notebook-instance-policy"
37+
description = "Policy for the Notebook Instance to manage training jobs, models and endpoints"
3738
path = "/"
38-
description = "NotebookInstanceIAMPolicy"
3939

4040
policy = <<EOF
4141
{
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

terraform/s3_kinesis.tf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "aws_s3_bucket" "s3_bucket_2" {
2+
bucket = "${var.s3_bucket_name_2}-${var.aws_region}"
3+
acl = "private"
4+
force_destroy = true # delete all data from this bucket before destroy
5+
6+
server_side_encryption_configuration {
7+
rule {
8+
apply_server_side_encryption_by_default {
9+
sse_algorithm = "AES256"
10+
}
11+
}
12+
}
13+
14+
tags = {
15+
Description = "Bucket for storing processed events for visualization features."
16+
Group = "${var.default_resource_group}"
17+
CreatedBy = "${var.default_created_by}"
18+
}
19+
}
File renamed without changes.

deployment-tf/s3_sagemaker.tf renamed to terraform/s3_sagemaker.tf

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
resource "aws_s3_bucket" "s3_bucket_1" {
22
bucket = "${var.s3_bucket_name_1}-${var.aws_region}"
33
acl = "private"
4-
force_destroy = true # delete all data from this bucket before destroy
4+
force_destroy = true # delete all data from this bucket before destroy
55

66
server_side_encryption_configuration {
77
rule {
@@ -18,26 +18,6 @@ resource "aws_s3_bucket" "s3_bucket_1" {
1818
}
1919
}
2020

21-
resource "aws_s3_bucket" "s3_bucket_2" {
22-
bucket = "${var.s3_bucket_name_2}-${var.aws_region}"
23-
acl = "private"
24-
force_destroy = true # delete all data from this bucket before destroy
25-
26-
server_side_encryption_configuration {
27-
rule {
28-
apply_server_side_encryption_by_default {
29-
sse_algorithm = "AES256"
30-
}
31-
}
32-
}
33-
34-
tags = {
35-
Description = "Bucket for storing processed events for visualization features."
36-
Group = "${var.default_resource_group}"
37-
CreatedBy = "${var.default_created_by}"
38-
}
39-
}
40-
4121
resource "aws_s3_bucket_object" "s3_fraud_detection_notebook" {
4222
bucket = "${aws_s3_bucket.fraud_detection_function_bucket.id}"
4323
key = "fraud-detection-using-machine-learning/${var.function_version}/notebooks/sagemaker_fraud_detection.ipynb"
File renamed without changes.

terraform/steps.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
terraform_backend.tf.template -> terraform_backend.tf
3+
terraform.tfvars.template -> terraform.tfvars
4+
5+
export AWS_PROFILE=<your desired profile>
6+
7+
terraform init
8+
terraform validate
9+
terraform plan -out=tfplan
10+
terraform apply --auto-approve tfplan
11+
12+
13+
14+
terraform plan -destroy -out=tfplan
15+
terraform apply tfplan

terraform/terraform.tfvars.template

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
aws_region="<region>"
2+
aws_profile="<profile>"
3+
function_bucket_name="<bucket-for-lambda-function>"
4+
function_version="<version>"
5+
s3_bucket_name_1="<bucket-1>"
6+
s3_bucket_name_2="<bucket-2>"
File renamed without changes.

0 commit comments

Comments
 (0)