Operations with EC2 instances in Ruby
204
You could import AWS credentials to a container as a volume with something like -v ~/.aws:/root/.aws
Template in container's config dir is only for example. At that template, AMI provided is an Ubuntu image of AWS free tier layer. Sensible data as subnet or security groups of the template are absolutely fake, so you need to edit this file or better create a YAML file into another directory and so attach it as a volume. In instance:
docker run --rm -ti -v ~/.aws:/root/.aws -v ~/ruby-aws/instances:/ec2/instances gustavomrfz/ec2ops-ruby:0.5.1 ruby ec2.rb
'docker run --rm -ti gustavomrfz/ec2ops-ruby:0.5.1 ruby ec2.rb -h'
Output:
Usage: ec2.rb [options]
Available options:
-r, --region REGION Supply a region
-c, --create RELATIVE_PATH Create the file(s) supplied
--start INSTANCE[s]-ID Start the INSTANCE[s]-ID supplied
--stop INSTANCE[s]-ID Stop the INSTANCE[s]-ID supplied
-t, --terminate INSTANCE-ID Terminate the INSTANCE-ID supplied
-d, --describe Describe EC2 instances in region
-v, --version Show version
-h, --help Show this message
You could set an alias as
alias ec2op="docker run --rm -ti -v ~/.aws:/root/.aws -v ~/ruby-aws/instances:/ec2/instances gustavomrfz/ec2ops-ruby:0.5.1 ruby ec2.rb "
and then
ec2op -v
In this markdown explanation, a real YAML would be in a container's directory called instances
ec2op --create instances
will parse all files with .yml extension in that relative folder
Content type
Image
Digest
Size
97 MB
Last updated
over 8 years ago
docker pull gustavomrfz/ec2ops-ruby:0.5.1