aws-ec2 0.7.0 → 0.8.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 +4 -0
- data/lib/aws-ec2.rb +0 -2
- data/lib/aws_ec2/cli.rb +11 -5
- data/lib/aws_ec2/create.rb +1 -1
- data/lib/aws_ec2/help/ami.md +5 -3
- data/lib/aws_ec2/help/compile_scripts.md +5 -0
- data/lib/aws_ec2/help/create.md +2 -6
- data/lib/aws_ec2/help/upload_scripts.md +9 -0
- data/lib/aws_ec2/script.rb +3 -0
- data/lib/aws_ec2/{compile.rb → script/compile.rb} +4 -3
- data/lib/aws_ec2/{s3.rb → script/upload.rb} +8 -5
- data/lib/aws_ec2/version.rb +1 -1
- metadata +5 -4
- data/lib/aws_ec2/help/compile.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c555a3e325c610710e0db4ab6839ae08a29020f96c06b740c5283b383d4c34a5
|
4
|
+
data.tar.gz: 3deb2d4cf2bbf39fb48dea6050ed1be67d2b3dcb4b68298bde8ad2bfc4ed8517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81e3a1e2e6186fb146aa3377afab79430170853bb579c3782a877be38592a33dd0c4980d7bc68c7f992be5b4e4f31e85537b989459fe80b49395c9bcebf3bdaa
|
7
|
+
data.tar.gz: 51dacb024e89a664e3c0b642a21220a67108a264f35d39d41ff25f9f9ece4acfec906e9f3ac01300238efc38b3ec9061ba3f4aba04af03ec40cc8009c7604f7e
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
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.8.0]
|
7
|
+
- aws-ec2 upload_scripts command
|
8
|
+
- rename aws-ec2 compile to aws-ec2 compile_scripts
|
9
|
+
|
6
10
|
## [0.7.0]
|
7
11
|
- Rid of name to profile convention, check profile exists and report to user
|
8
12
|
if it does not exist. This is a more expected interface.
|
data/lib/aws-ec2.rb
CHANGED
data/lib/aws_ec2/cli.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module AwsEc2
|
2
2
|
class CLI < Command
|
3
|
-
class_option :verbose, type: :boolean
|
4
3
|
class_option :noop, type: :boolean
|
5
4
|
class_option :profile, desc: "profile name to use"
|
6
5
|
|
@@ -20,10 +19,17 @@ module AwsEc2
|
|
20
19
|
Ami.new(options.merge(name: name)).run
|
21
20
|
end
|
22
21
|
|
23
|
-
desc "
|
24
|
-
long_desc Help.text(:
|
25
|
-
def
|
26
|
-
Compile.new(options).compile
|
22
|
+
desc "compile_scripts", "compiles app/scripts and app/user-data to tmp folder"
|
23
|
+
long_desc Help.text(:compile_scripts)
|
24
|
+
def compile_scripts
|
25
|
+
Script::Compile.new(options).compile
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "upload_scripts", "compiles and uploads scripts to s3"
|
29
|
+
long_desc Help.text(:upload_scripts)
|
30
|
+
option :compile, type: :boolean, default: true, desc: "compile scripts before uploading"
|
31
|
+
def upload_scripts
|
32
|
+
Script::Upload.new(options).upload
|
27
33
|
end
|
28
34
|
end
|
29
35
|
end
|
data/lib/aws_ec2/create.rb
CHANGED
data/lib/aws_ec2/help/ami.md
CHANGED
@@ -2,10 +2,12 @@ Examples:
|
|
2
2
|
|
3
3
|
$ aws-ec2 ami myrubyami --profile ruby --noop
|
4
4
|
|
5
|
-
|
5
|
+
Launches an EC2 instance to create an AMI. An AMI creation script is appended to the end of the user-data script. The AMI creation script calls `aws ec2 create-image` and causes the instance to reboot at the end.
|
6
|
+
|
7
|
+
It is useful to include to timestamp as a part of the AMI name with the date command.
|
6
8
|
|
7
9
|
$ aws-ec2 ami $(date "+ruby-2.5.0_%Y-%m-%d-%H-%M") --profile ruby --noop
|
8
10
|
|
9
|
-
|
11
|
+
The instance also automatically gets terminated and cleaned up by a termination script appended to user-data.
|
10
12
|
|
11
|
-
|
13
|
+
It is recommended to use the `set -e` option in your user-data script so that if the script fails, the AMI creation script is never reached and the instance is left behind so you can debug.
|
data/lib/aws_ec2/help/create.md
CHANGED
@@ -2,10 +2,6 @@ Examples:
|
|
2
2
|
|
3
3
|
$ aws-ec2 create my-instance
|
4
4
|
|
5
|
-
|
5
|
+
To see the snippet of code that gets added to the user-data script you can use the `--noop` option and then view the generated /tmp/aws-ec2/user-data.txt.
|
6
6
|
|
7
|
-
$ aws-ec2 create
|
8
|
-
|
9
|
-
To see the snippet of code that gets added to the user-data script you can use the aws-ec2 userdata command.
|
10
|
-
|
11
|
-
$ aws-ec2 userdata myscript --ami myname
|
7
|
+
$ aws-ec2 create myscript --noop
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Examples:
|
2
|
+
|
3
|
+
$ aws-ec2 upload_scripts
|
4
|
+
|
5
|
+
Compiles the app/scripts and app/user-data files to the tmp folder. Then uploads the files to an s3 bucket that is configured in config/[AWS_EC2_ENV].yml. Example scripts_s3_bucket config:
|
6
|
+
|
7
|
+
```yaml
|
8
|
+
scripts_s3_bucket: my-bucket # enables auto sync to s3
|
9
|
+
```
|
data/lib/aws_ec2/script.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
# Class for aws-ec2 upload_scripts command
|
4
|
+
class AwsEc2::Script
|
5
|
+
class Upload < AwsEc2::Base
|
3
6
|
def initialize(options={})
|
4
7
|
@options = options
|
5
8
|
end
|
6
9
|
|
7
|
-
def upload
|
8
|
-
compiler.compile
|
10
|
+
def upload
|
11
|
+
compiler.compile if @options[:compile]
|
9
12
|
sync_scripts_to_s3
|
10
|
-
compiler.clean
|
13
|
+
compiler.clean if @options[:compile] and !ENV['AWS_EC2_KEEP']
|
11
14
|
end
|
12
15
|
|
13
16
|
def sync_scripts_to_s3
|
data/lib/aws_ec2/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
@@ -204,7 +204,6 @@ files:
|
|
204
204
|
- lib/aws_ec2/base.rb
|
205
205
|
- lib/aws_ec2/cli.rb
|
206
206
|
- lib/aws_ec2/command.rb
|
207
|
-
- lib/aws_ec2/compile.rb
|
208
207
|
- lib/aws_ec2/config.rb
|
209
208
|
- lib/aws_ec2/core.rb
|
210
209
|
- lib/aws_ec2/create.rb
|
@@ -212,12 +211,14 @@ files:
|
|
212
211
|
- lib/aws_ec2/dotenv.rb
|
213
212
|
- lib/aws_ec2/help.rb
|
214
213
|
- lib/aws_ec2/help/ami.md
|
215
|
-
- lib/aws_ec2/help/
|
214
|
+
- lib/aws_ec2/help/compile_scripts.md
|
216
215
|
- lib/aws_ec2/help/create.md
|
216
|
+
- lib/aws_ec2/help/upload_scripts.md
|
217
217
|
- lib/aws_ec2/hook.rb
|
218
218
|
- lib/aws_ec2/profile.rb
|
219
|
-
- lib/aws_ec2/s3.rb
|
220
219
|
- lib/aws_ec2/script.rb
|
220
|
+
- lib/aws_ec2/script/compile.rb
|
221
|
+
- lib/aws_ec2/script/upload.rb
|
221
222
|
- lib/aws_ec2/scripts/ami_creation.sh
|
222
223
|
- lib/aws_ec2/scripts/auto_terminate.sh
|
223
224
|
- lib/aws_ec2/template_helper.rb
|