y2k2mt / aws-credentials.cr Goto Github PK
View Code? Open in Web Editor NEWGet AWS credentials in various ways.
License: MIT License
Get AWS credentials in various ways.
License: MIT License
So first thanks for sharing your work.
I already use your work in small project in development branch :)
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.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
......
Resolving credential via AWS Security Token Service(STS) as assume role.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.