-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Create IAM Role for ECS Task Role and ECS Execution Role (same role) - Encrypt EFS Volume with key that is managed here - Add EFS File Policy to ensure data transit is encrypted - Optimize security groups for NFS communication from ECS to EFS - Enable Cloudwatch Logging from ECS Cluster and ECS Solr Task Definition
- Loading branch information
1 parent
623ff0f
commit d71744e
Showing
5 changed files
with
190 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,67 @@ | ||
|
||
|
||
resource "aws_efs_file_system" "solr-data" { | ||
creation_token = "solr-data" | ||
|
||
# encryption-at-rest | ||
encrypted = true | ||
tags = { | ||
Name = "SolrData" | ||
} | ||
} | ||
|
||
resource "aws_efs_access_point" "solr-data-access" { | ||
resource "aws_efs_access_point" "solr-data-ap" { | ||
file_system_id = aws_efs_file_system.solr-data.id | ||
# EFS needs to be mounted as root to be able to write-to/create files | ||
posix_user { | ||
gid = "0" | ||
uid = "0" | ||
} | ||
} | ||
|
||
resource "aws_efs_mount_target" "all" { | ||
count = length(module.vpc.public_subnets) | ||
file_system_id = aws_efs_file_system.solr-data.id | ||
subnet_id = module.vpc.public_subnets[count.index] | ||
} | ||
|
||
resource "aws_efs_file_system_policy" "policy" { | ||
file_system_id = aws_efs_file_system.solr-data.id | ||
|
||
# encryption-in-transit | ||
policy = <<-POLICY | ||
{ | ||
"Version": "2012-10-17", | ||
"Id": "efs-policy", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"AWS": "*" | ||
}, | ||
"Action": [ | ||
"elasticfilesystem:ClientRootAccess", | ||
"elasticfilesystem:ClientWrite", | ||
"elasticfilesystem:ClientMount" | ||
], | ||
"Condition": { | ||
"Bool": { | ||
"elasticfilesystem:AccessedViaMountTarget": "true" | ||
} | ||
} | ||
}, | ||
{ | ||
"Effect": "Deny", | ||
"Principal": { | ||
"AWS": "*" | ||
}, | ||
"Action": "*", | ||
"Condition": { | ||
"Bool": { | ||
"aws:SecureTransport": "false" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
POLICY | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
resource "aws_kms_key" "ecs-log-key" { | ||
description = "ecs log key" | ||
deletion_window_in_days = 7 | ||
} | ||
|
||
resource "aws_cloudwatch_log_group" "ecs-logs" { | ||
name = "ecs-logs-solr" | ||
} |
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