Created
March 19, 2023 20:57
-
-
Save sorentwo/ba4a07d3a011d212c19a5bb775a6c536 to your computer and use it in GitHub Desktop.
EC2 ASG Cloud for Oban Auto Scaling
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
defmodule Oban.Pro.Clouds.EC2ASG do | |
@behaviour Oban.Pro.Cloud | |
@impl Oban.Pro.Cloud | |
def init(opts), do: Map.new(opts) | |
@impl Oban.Pro.Cloud | |
def scale(desired, conf) do | |
params = %{ | |
"Action" => "SetDesiredCapacity", | |
"AutoScalingGroupName" => conf.asg, | |
"DesiredCapacity" => desired, | |
"Version" => "2011-01-01" | |
} | |
ExAws.request(%ExAws.Operation.Query{ | |
path: "", | |
params: params, | |
service: :autoscaling, | |
action: :set_desired_capacity | |
}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment