Skip to content

Instantly share code, notes, and snippets.

{
"Volumes": [
{
"AvailabilityZone": "us-west-2a",
"Attachments": [
{
"AttachTime": "2013-09-17T00:55:03.000Z",
"InstanceId": "i-a071c394",
"VolumeId": "vol-e11a5288",
"State": "attached",
package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/Jeffail/gabs"
)
const COMMANDS = {
"1F": [3],
"1B": [5],
"1L": [11],
"1R": [13],
"1FR": [3, 13],
"1FL": [3, 11],
"1BR": [5, 13],
"1BL": [5, 11],
"2F": [18],
type AmazonResponse struct {
Reservations []Reservation `json:"Reservations"`
}
type Reservation struct {
Instances []Instace `json:"Instances"`
}
type Instance struct {
PublicIpAddres string `json:"PublicIpAddres"`
#!/usr/bin/python3
import pygame
import sys
class Game():
def __init__(self):
self._running = True
@KensoDev
KensoDev / main.py
Last active May 10, 2023 11:17
Lambda function to notify slack on ECS failed deployments
"""
Get notification from ECS when a deployment is failing. Post to slack
This lambda function receives a notification from a cloudwatch log filter when
an ECS deployment fails, it creates a hash based on the cluster arn and then
task definition and saves the file in S3.
To make sure we don't get duplicate, if we already have a file in S3, we don't
resend the notification.
@KensoDev
KensoDev / cloudwatch-notification.json
Created April 17, 2017 17:47
Cloudwatch notification
{
"account": "{account-id}",
"detail": {
"clusterArn": "arn:aws:ecs:us-east-1:{account-id}:cluster/{cluster-id}",
"containerInstanceArn": "arn:aws:ecs:us-east-1:{account-id}:container-instance/0b1a4979-3846-4e3e-846f-b63a9ad545b0",
"containers": [
{
"containerArn": "arn:aws:ecs:us-east-1:{account-id}:container/4ce75a22-f1c9-4ac2-8607-a503e7682c1d",
"exitCode": 1,
"lastStatus": "STOPPED",
@KensoDev
KensoDev / notifications.tf
Created April 14, 2017 01:18
Cluster notification terraform
/*
Read more about event patterns here:
http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html
*/
data "template_file" "event_pattern" {
template = "${file("${path.module}/files/deploy-notification.json.tpl")}"
vars = {
cluster_arn = "${aws_ecs_cluster.ecs.id}"
}
@KensoDev
KensoDev / deploy-notification.json.tpl
Created April 14, 2017 01:16
cluster monitoring notification template
{
"source": [
"aws.ecs"
],
"detail-type": [
"ECS Task State Change"
],
"detail": {
"clusterArn": [
"${cluster_arn}"
{"error_code":"bad_gateway","id":1491925505.798,"message":"We were not able to connect to the upstream server, please contact support@kloudless.com with the details of the request you made"}