Skip to content

Instantly share code, notes, and snippets.

@git-josip
git-josip / deregister_target.go
Last active February 19, 2021 13:02
This code is forked from https://gist.github.com/jicowan/ad5e13d12577b41a22f83ed91a3e61bf . In original version there were few issues. First issue was that target de register was called multiple time, and that was happening because there was iteration trough all attachments, and we should only filter attachment which has type = `eni` where detai…
package main
// This code is forked from https://gist.github.com/jicowan/ad5e13d12577b41a22f83ed91a3e61bf .
// In original version there were few issues.
// **** First issue was that target de register was called multiple time, and that was happening because there was
// iteration trough all attachments, and we should only filter attachment which has type = `eni` where details
// about subnet and ip are.
// **** Second issue was that original code was not working when you have multiple target groups in load balancer,
// as in my case, where i have multiple target groups, for api traffic and for management traffic where application
// health status and info is. I refactored code to use array of target groups.
@git-josip
git-josip / main.go
Created February 16, 2021 10:03 — forked from jicowan/main.go
ECS Fargate tasks that are stopped by Spot interruptions are not deregistered from load balancers automatically. This function deregister an ECS Fargate Spot task from an AWS load balancer when it is interrupted..
package main
import (
"context"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ecs"
"github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
@git-josip
git-josip / PaypalController.scala
Created February 25, 2016 06:38 — forked from mslinn/PaypalController.scala
Paypal IPN script for Play 2.1
package controllers
import play.api._
import libs.ws.WS
import play.api.mvc._
import com.micronautics.paypal.{TransactionProcessor, PaypalTransactions}
import java.net.URLEncoder
import concurrent.{Await, ExecutionContext}
import concurrent.duration.Duration
import java.util.concurrent.TimeUnit
package com.josip.reactiveluxury.core.messages
import com.josip.reactiveluxury.core.Asserts
import play.api.libs.functional.syntax._
import play.api.libs.json._
import Asserts._
case class Message private
(
messageType : MessageType,