{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-ebs",
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 troposphere import Template, Ref, Parameter, Tags | |
from troposphere.autoscaling import LaunchConfiguration, AutoScalingGroup, Tag | |
t = Template() | |
params = { | |
'AmiId': 'Baked AMI Id', | |
'InstanceName': 'Name tag of the instance', | |
'SecurityGroup': 'Security Group' , | |
'KeyName': 'SSH Key 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
#!/usr/bin/env python | |
import requests | |
import json | |
# Converts AWS EC2 instance metadata to a dictionary | |
def load(): | |
metaurl = 'http://169.254.169.254/latest' | |
# those 3 top subdirectories are not exposed with a final '/' |
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
<Plugin python> | |
ModulePath "/home/imil/collectd" | |
Import "ethermine" | |
<Module ethermine> | |
wallet "0xf00f00f00" | |
interval "300" | |
url "https://ethermine.org/api/miner_new" | |
</Module> | |
</Plugin> |
This snippet is a sample showing how to implement CloudWatch Logs streaming to ElasticSearch using terraform
.
I wrote this gist
because I didn't found a clear, end-to-end example on how to achieve this task. In particular,
I understood the resource "aws_lambda_permission" "cloudwatch_allow"
part by reading a couple of bug reports plus
this stackoverflow post.
The js
file is actually the Lambda function automatically created by AWS when creating this pipeline through the
web console. I only added a endpoint
variable handling so it is configurable from terraform
.
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 ( | |
"encoding/json" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"strconv" | |
"time" |
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
terraform apply tfplan | |
2018/12/06 14:44:36 [INFO] Terraform version: 0.11.10 17850e9a55d33c43d7c31fd6ac122ba97a51d899 | |
2018/12/06 14:44:36 [INFO] Go runtime version: go1.11.1 | |
2018/12/06 14:44:36 [INFO] CLI args: []string{"/home/imil/pkg/bin/terraform", "apply", "tfplan"} | |
2018/12/06 14:44:36 [DEBUG] Attempting to open CLI config file: /home/imil/.terraformrc | |
2018/12/06 14:44:36 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2018/12/06 14:44:36 [INFO] CLI command args: []string{"apply", "tfplan"} | |
2018/12/06 14:44:36 [INFO] command: initializing local backend from plan (not set) | |
2018/12/06 14:44:36 [DEBUG] checking for provider in "." | |
2018/12/06 14:44:36 [DEBUG] checking for provider in "/home/imil/pkg/bin" |
OlderNewer