This file contains hidden or 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
| { | |
| "family": "nginx", | |
| "executionRoleArn": "arn:aws:iam::XXXXXXXXXXXX:role/ecsTaskExecutionRole", | |
| "taskRoleArn": "arn:aws:iam::XXXXXXXXXXXX:role/Sandbox-ECS-Nginx-Service-Role", | |
| "containerDefinitions": [ | |
| { | |
| "name": "log_router", | |
| "image": "docker.io/amazon/aws-for-fluent-bit:latest", | |
| "cpu": 0, | |
| "memoryReservation": 50, |
This file contains hidden or 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
| { | |
| "Version": "2008-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Service": "ecs-tasks.amazonaws.com" | |
| }, | |
| "Action": "sts:AssumeRole" |
This file contains hidden or 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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "es:ESHttpPost", | |
| "es:ESHttpPut" | |
| ], | |
| "Resource": "arn:aws:es:us-east-1:XXXXXXXXXXXX:domain/sandbox" |
This file contains hidden or 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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "dynamodb:Scan", | |
| "dynamodb:PutItem", | |
| "dynamodb:UpdateItem" | |
| ], |
This file contains hidden or 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
| import boto3 | |
| import logging | |
| eip_tag_key = "EIP-fleet" | |
| eip_tag_value = "true" | |
| dynamodb_table = "EC2-Spots-EIP" | |
| logger = logging.getLogger() | |
| logger.setLevel("INFO") |
This file contains hidden or 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
| #!/bin/bash | |
| # OpenSearch parameters | |
| HOST="https://your-opensearch-url" | |
| INDEX="app" | |
| # Function to generate random data | |
| generate_random_data() { | |
| echo "{ \"timestamp\": \"$(date -Is)\", \"value\": $RANDOM }" | |
| } |
This file contains hidden or 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
| ### AWS Fluent Bit | |
| resource "helm_release" "fluent-bit" { | |
| name = "aws-for-fluent-bit" | |
| repository = "https://aws.github.io/eks-charts" | |
| chart = "aws-for-fluent-bit" | |
| namespace = var.namespace | |
| version = var.helm_version | |
| dependency_update = true |
This file contains hidden or 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
| [FILTER] | |
| Name kubernetes | |
| Match ${var.opensearch_filter}.* | |
| Kube_URL https://kubernetes.default.svc.cluster.local:443 | |
| Merge_Log On | |
| # For rewrite_tag filter, Keep_log must be On | |
| Keep_log On | |
| K8S-Logging.Parser On | |
| K8S-Logging.Exclude On | |
| Kube_Tag_Prefix ${var.opensearch_filter}.var.log.containers. |
This file contains hidden or 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
| variable "log_s3_outputs" { | |
| type = list(object({ | |
| bucket = string | |
| namespace = string | |
| app = string | |
| tag_prefix = string | |
| bucket_out_prefix = string | |
| total_file_size = optional(string, "250M") | |
| upload_timeout = optional(string, "10m") | |
| shipping_logs_to_os = optional(string, "false") |
This file contains hidden or 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
| # Get list of buckets without duplicates for IAM policy | |
| locals { | |
| log_s3_buckets = toset([for o in var.log_s3_outputs : o.bucket]) | |
| } | |
| data "aws_iam_policy_document" "s3-logging" { | |
| dynamic "statement" { | |
| for_each = local.log_s3_buckets | |
| content { |