Code Monkey home page Code Monkey logo

aws-credentials.cr's People

Contributors

neochrome avatar surume avatar y2k2mt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

chussenot surume

aws-credentials.cr's Issues

default credential in `~/.aws` folder

So first thanks for sharing your work.

I already use your work in small project in development branch :)

issue

When I run the application the SharedCredentialFile strategy will be execued even if I pass the AWS_* variables. And this provider fail if there is no default credentials defined.

Missing hash key: "default"

exemple

exemple.cr

require "./aws"
require "json"  # As you can see I have to require "json" too to get the providers working well.
require "aws-credentials"

module GScaler
  VERSION = "0.2.2"
  include Aws::Credentials

  def self.provider
    @@provider = Providers.new ([
      EnvProvider.new,
      SharedCredentialFileProvider.new,
      InstanceMetadataProvider.new
    ] of Provider)
  end

  def self.client
    @@client ||= Aws::Autoscaling::Client.new(ENV["AWS_REGION"],
      provider.credentials.access_key_id, provider.credentials.secret_access_key)
  end

  def self.watch(name, value)
    start_time = Time.now
    interval = 5
    checks = 0
    loop do
      if (Time.now - start_time).total_minutes > 2
        puts "We can't reach the the desired state..."
        exit
      end
      activities = GScaler.client.describe_scaling_activities(name)
      activities.each do |a|
        puts "#{a.id}: #{a.status} => #{a.description}"
      end
      group = GScaler.client.describe_autoscaling_group(name)
      if group.pool_state == "InService" && group.instances.size == value
        puts "check: The instance pool reached an InService state of #{group.instances.size} (#{checks})"
        checks += 1
        interval *= 2
        exit if checks == 5
      else
        interval = 5
        checks = 0
      end
      sleep interval
    end
  end

......

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.