-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
70 lines (62 loc) · 2.24 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
provider "aws" {
access_key = "YOUR_ACCESS_KEY"
secret_key = "YOUR_SECRET_KEY"
region = "YOUR_REGION"
}
# Criação do API Gateway
resource "aws_api_gateway_rest_api" "fraud_detection" {
name = "fraud_detection"
}
# Criação do AWS Lambda
resource "aws_lambda_function" "fraud_detection_lambda" {
filename = "fraud_detection_lambda.zip"
function_name = "fraud_detection_lambda"
role = "arn:aws:iam::${var.account_id}:role/lambda-role"
handler = "lambda_handler"
runtime = "python3.8"
source_code_hash = filebase64sha256("fraud_detection_lambda.zip")
}
# Criação do endpoint do modelo de detecção de fraudes usando o Amazon SageMaker
resource "aws_sagemaker_endpoint" "fraud_detection_endpoint" {
name = "fraud_detection_endpoint"
endpoint_config_name = "fraud_detection_endpoint_config"
}
# Criação da configuração do endpoint do modelo de detecção de fraudes usando o Amazon SageMaker
resource "aws_sagemaker_endpoint_configuration" "fraud_detection_endpoint_config" {
name = "fraud_detection_endpoint_config"
production_variants {
variant_name = "fraud_detection_variant"
initial_instance_count = 1
instance_type = "ml.t2.medium"
model_name = "fraud_detection_model"
}
}
# Criação do Kinesis Data Firehose
resource "aws_kinesis_firehose_delivery_stream" "fraud_detection_firehose" {
name = "fraud_detection_firehose"
destination = "s3"
s3_configuration {
role_arn = "arn:aws:iam::${var.account_id}:role/kinesis-role"
bucket_arn = "arn:aws:s3:::fraud_detection_bucket"
buffer_size = 5
buffer_interval = 300
compression_format = "GZIP"
}
}
# Criação do Amazon S3 Bucket para as transações
resource "aws_s3_bucket" "fraud_detection_bucket" {
bucket = "fraud_detection_bucket"
acl = "private"
}
# Criação do Amazon S3 Bucket para os modelos
resource "aws_s3_bucket" "fraud_detection_models_bucket" {
bucket = "fraud_detection_models_bucket"
acl = "private"
}
# Criação do Amazon QuickSight
resource "aws_quicksight_user" "quicksight_user" {
email = "gabriel@europeos.com"
identity_type = "IAM"
user_role = "AUTHOR"
session_name_prefix = "quicksight_session"
}