README.md in awsecrets-1.0.0 vs README.md in awsecrets-1.1.0
- old
+ new
@@ -2,11 +2,11 @@
AWS credentials loader
## awsecrets config precedence
-1. Command Line Options
+1. Command Line Options (Awscreds#load method args OR self optparse)
2. Environment Variables
3. YAML file (secrets.yml)
4. The AWS credentials file
5. The CLI configuration file
@@ -25,9 +25,40 @@
$ bundle
Or install it yourself as:
$ gem install awsecrets
+
+## Usage example
+
+Create command line tool `ec2sample` like following code
+
+```ruby
+#!/usr/bin/env ruby
+require 'awsecrets'
+Awsecrets.load
+ec2_client = Aws::EC2::Client.new
+puts ec2_client.describe_instances({ instance_ids: [ARGV.first] }).reservations.first.instances.first
+```
+
+And execute
+
+```sh
+$ ec2sample i-1aa1aaaa --profile mycreds --region ap-northeast-1
+
+or
+
+$ AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX AWS_REGION=ap-northeast-1 ec2sample i-1aa1aaaa
+
+or
+
+$ cat <<EOF > secrets.yml
+region: ap-northeast-1
+aws_access_key_id: XXXXXXXXXXXXXXXXXXXX
+aws_secret_access_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+EOF
+$ ec2sample i-1aa1aaaa
+```
## Contributing
1. Fork it ( https://github.com/k1LoW/awsecrets/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)