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
# Based on Puckel image for Airflow | |
# SOURCE: https://github.com/puckel/docker-airflow | |
FROM python:3.6-slim | |
MAINTAINER Joao Ferrao | |
# Never prompts the user for choices on installation/configuration of packages | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV TERM linux | |
# Airflow |
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
# from https://github.com/apache/incubator-airflow/blob/master/airflow/example_dags/tutorial.py | |
# -*- coding: utf-8 -*- | |
""" | |
### Tutorial Documentation | |
Documentation that goes along with the Airflow tutorial located | |
[here](https://airflow.incubator.apache.org/tutorial.html) | |
""" | |
import airflow | |
from airflow import DAG |
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 Implementation | |
def _get_json_message(json_message): | |
msg = {} | |
if json_message is None: | |
return msg | |
if os.path.exists(json_message) and os.path.isfile(json_message): | |
try: | |
with open(json_message, "r") as in_file: |
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
# replaces _get_json_message() | |
def _get_json_messages_simulated(json_message): | |
msg = {} | |
if json_message is None: | |
return msg | |
if os.path.exists(json_message) and os.path.isfile(json_message): | |
try: | |
list_of_events = [] | |
with open(json_message, 'r') as f: |
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
# Following assumes you already have an ECS Cluster in place | |
resource "aws_lb" "this" { | |
name = "some-service-nlb" | |
load_balancer_type = "network" | |
internal = false | |
idle_timeout = "150" | |
subnets = "${var.subnet_list}" | |
} |
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
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi" | |
"github.com/olekukonko/tablewriter" | |
"os" | |
"strings" |
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
// TraceableRegions is a list of AWS regions we want to crawl | |
var TraceableRegions = [...]string{"us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-north-1", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1"} | |
// SingleResource defines how we want to describe each AWS resource | |
type SingleResource struct { | |
Region *string | |
Service *string | |
Product *string | |
Details *string | |
ID *string |
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
// GetServiceFromArn removes the arn:aws: component string of | |
// the name and returns the first keyword that appears, svc | |
func ServiceNameFromARN(arn *string) *string { | |
shortArn := strings.Replace(*arn, "arn:aws:", "", -1) | |
sliced := strings.Split(shortArn, ":") | |
return &sliced[0] | |
} | |
// Short ARN removes the unnecessary info from the ARN we already | |
// know at this point like region, account id and the service name. |
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
// awsEC2 type is created for ARNs belonging to the EC2 service | |
type awsEC2 string | |
// awsECS type is created for ARNs belonging to the ECS service | |
type awsECS string | |
// awsGeneric is a is a generic AWS for services ARNs that don't have | |
// a dedicated type within our application. | |
type awsGeneric string |
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
func main() { | |
var resources []*SingleResource | |
for _, region := range TraceableRegions { | |
// We need to create a new CFG for each region. We | |
// could actually update the region after the fact | |
// but let's focus on the purpose, here :) | |
cfg := aws.Config{Region: aws.String(region)} | |
s := session.Must(session.NewSessionWithOptions(session.Options{ |
OlderNewer