aws-ec2 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +11 -3
- data/example/profiles/user-data/dev.sh +2 -2
- data/lib/aws-ec2.rb +4 -0
- data/lib/aws_ec2/config.rb +17 -0
- data/lib/aws_ec2/core.rb +16 -0
- data/lib/aws_ec2/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dea551aeb6e2d51a45460e30e408f4a82a32f61356f2e1391bcc837081272d28
|
4
|
+
data.tar.gz: f2dbabe12ceb094fba4fa6accb920e5a4bd38436ba5095dc1e26a1b53acb573c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 158ca61a47b19c5ed7ebc3a81331170df07cd7c55dac58df4610948a14c2e7ead29f7f132c1654479b7b0559da220952681f950cfe0977ef1a9c7401584205f2
|
7
|
+
data.tar.gz: 0e1d65584446dc61b176a75f0d16bb6f113b8574e103980e592875c500d4d002f59e2faf82e99def3eae12d62af28b8d34e1e0662729655c02c0933bfcef2174
|
data/CHANGELOG.md
CHANGED
@@ -3,5 +3,8 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.2.0]
|
7
|
+
- add config files support. example: config/development.yml
|
8
|
+
|
6
9
|
## [0.1.0]
|
7
10
|
- initial release
|
data/README.md
CHANGED
@@ -9,17 +9,17 @@ Example:
|
|
9
9
|
## Usage
|
10
10
|
|
11
11
|
```sh
|
12
|
-
|
12
|
+
aws-ec2 create myserver --profile myserver
|
13
13
|
```
|
14
14
|
|
15
|
-
In a nutshell, the profile parameters are passed to the ruby aws-sdk [AWS::EC2::Client#run_instances](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Client.html#run_instances-instance_method) method. So you can specify any parameter you wish that is available there.
|
15
|
+
In a nutshell, the profile parameters are passed to the ruby aws-sdk [AWS::EC2::Client#run_instances](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Client.html#run_instances-instance_method) method. So you can specify any parameter you wish that is available there. To check out what a profile looks like look at the [example default](example/profiles/default.yml)
|
16
16
|
|
17
17
|
### Convention
|
18
18
|
|
19
19
|
By convention, the profile name matches the first parameter after the create command. So the command above could be shortened to:
|
20
20
|
|
21
21
|
```
|
22
|
-
|
22
|
+
aws-ec2 create myserver
|
23
23
|
```
|
24
24
|
|
25
25
|
## User-Data
|
@@ -34,6 +34,14 @@ The user-data script is generated on the machine that is running the aws-ec2 com
|
|
34
34
|
|
35
35
|
To use the user-data script when creating an EC2 instance, you can use the helper method in the profile.
|
36
36
|
|
37
|
+
## Noop mode
|
38
|
+
|
39
|
+
You can do a test run with the `--noop` flag. This will print out what settings will be used to launch the instance.
|
40
|
+
|
41
|
+
```sh
|
42
|
+
aws-ec2 create myserver --profile myserver --noop
|
43
|
+
```
|
44
|
+
|
37
45
|
## Spot Instance Support
|
38
46
|
|
39
47
|
Spot instance support natively supported by the AWS run_instances command. Simply add `instance_market_options` to the parameters to request for a spot instance. The available spot market options are available here:
|
@@ -4,7 +4,7 @@ exec > >(tee "/var/log/user-data.log" | logger -t user-data -s 2>/dev/console) 2
|
|
4
4
|
export HOME=/root # user-data env runs in weird shell where user is root but HOME is not set
|
5
5
|
<% pubkey_path = "#{ENV['HOME']}/.ssh/id_rsa.pub" -%>
|
6
6
|
<% if File.exist?(pubkey_path) -%>
|
7
|
-
|
7
|
+
<% pubkey = IO.read(pubkey_path).strip -%>
|
8
8
|
# Automatically add user's public key
|
9
9
|
echo <%= pubkey %> >> ~/.ssh/authorized_keys
|
10
10
|
echo <%= pubkey %> >> /home/ec2-user/.ssh/authorized_keys
|
@@ -24,7 +24,7 @@ yum install -y git gcc make readline-devel openssl-devel
|
|
24
24
|
git clone git://github.com/sstephenson/ruby-build.git /tmp/ruby-build
|
25
25
|
cd /tmp/ruby-build
|
26
26
|
./install.sh
|
27
|
-
echo 'export PATH="/usr/local/bin:$PATH' >> ~/.bashrc
|
27
|
+
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
|
28
28
|
|
29
29
|
# Install rbenv for root
|
30
30
|
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
|
data/lib/aws-ec2.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module AwsEc2
|
4
|
+
class Config
|
5
|
+
def initialize(path="#{AwsEc2.root}/config/#{AwsEc2.env}.yml")
|
6
|
+
@path = path
|
7
|
+
end
|
8
|
+
|
9
|
+
def settings
|
10
|
+
YAML.load_file(@path)
|
11
|
+
rescue Errno::ENOENT => e
|
12
|
+
puts e.message
|
13
|
+
puts "The #{@path} does not exist. Please double check that it exists."
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/aws_ec2/core.rb
ADDED
data/lib/aws_ec2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -165,6 +165,8 @@ files:
|
|
165
165
|
- lib/aws_ec2/aws_services.rb
|
166
166
|
- lib/aws_ec2/cli.rb
|
167
167
|
- lib/aws_ec2/command.rb
|
168
|
+
- lib/aws_ec2/config.rb
|
169
|
+
- lib/aws_ec2/core.rb
|
168
170
|
- lib/aws_ec2/create.rb
|
169
171
|
- lib/aws_ec2/help.rb
|
170
172
|
- lib/aws_ec2/help/create.md
|