New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

awsops

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awsops - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

cmd/s3cp.js

19

bin/awsops.js

@@ -12,17 +12,25 @@ #!/usr/bin/env node

.command('s3cp', 'Download/upload a file from/to an S3 bucket')
.example('awsops s3cp archive.tar.gz s3://my-archive-bucket/archive-2016-08-12.tar.gz')
.describe('auth', 'Optionally use a specified file for authentication')
.nargs('auth', 1)
.describe('id', 'Optionally filter by an EC2 instance ID')
.describe('id', 'When using ls or ssh, optionally filter by an EC2 instance ID')
.nargs('id', 1)
.describe('name', 'Optionally filter by an EC2 instance\'s name')
.describe('name', 'When using ls or ssh, optionally filter by an EC2 instance\'s name')
.nargs('name', 1)
.describe('only', 'Optionally return a comma-separated list of fields instead of rendering a table')
.describe('only', 'When using ls or ssh, optionally return a comma-separated list of fields instead of rendering ' +
'a table')
.nargs('only', 1)
.describe('security-group', 'Optionally filter by a security group')
.describe('security-group', 'When using ls or ssh, optionally filter by a security group')
.nargs('security-group', 1)
.describe('quiet', 'When using s3cp, do not use the progress bar')
.boolean('quiet')
.alias('q', 'quiet')
.help('help')

@@ -72,5 +80,2 @@ .count('verbose')

args.options = [ 'id', 'name', 'security_group' ];
if (args['security-group']) args.security_group = args['security-group'];
// Run the command, passing it our credentials & arguments

@@ -77,0 +82,0 @@ cmders[cmd].call(null, conf, args, function (err, meta) {

@@ -6,2 +6,5 @@ var _ = require('lodash');

module.exports = function (config, args, callback) {
args.options = [ 'id', 'name', 'security_group' ];
if (args['security-group']) args.security_group = args['security-group'];
aws.lookupEc2Instances(config.ec2 || {}, _.pick(args, args.options), function (err, instances) {

@@ -8,0 +11,0 @@ if (err) return callback(err);

@@ -11,3 +11,4 @@ var _ = require('lodash');

module.exports = function (config, args, callback) {
config = config || {};
args.options = [ 'id', 'name', 'security_group' ];
if (args['security-group']) args.security_group = args['security-group'];

@@ -14,0 +15,0 @@ var ssh_exec = args._.slice(1);

@@ -151,3 +151,3 @@ var _ = require('lodash');

var bar = null;
if (!opts.silence) {
if (opts.progress) {
bar = new ProgressBar('Downloading ' + path.basename(opts.local_path) + ' [:bar] :percent :etas', {

@@ -270,15 +270,43 @@ complete: '=',

// console.log('Uploading ' + opts.local_path + ' to ' + opts.bucket + ' ' + opts.remote_path);
opts.local_path = path.resolve(opts.local_path);
var s3 = (!config || _.isPlainObject(config)) ? (new AWS.S3(config || {})) : config;
var params = {
Body: fs.createReadStream(opts.local_path),
Bucket: opts.bucket,
Key: opts.remote_path
};
fs.stat(opts.local_path, function (err, stats) {
if (err) {
switch (err.code) {
case 'EACCES': err.message = 'File ' + opts.local_path + ' requires elevated privileges'; break;
case 'ENOENT': err.message = 'No such file ' + opts.local_path; break;
}
return callback(err);
}
if (opts.acl) params.ACL = opts.acl;
if (opts.content_type) params.ContentType = opts.content_type;
var bar = null;
var size = parseInt(stats.size, 10);
s3.upload(params).send(callback);
if (opts.progress) {
bar = new ProgressBar('Uploading ' + path.basename(opts.local_path) + ' [:bar] :percent :etas', {
complete: '=',
incomplete: ' ',
width: 20,
total: size
});
}
var s3 = (!config || _.isPlainObject(config)) ? (new AWS.S3(config || {})) : config;
var params = {
Body: fs.createReadStream(opts.local_path),
Bucket: opts.bucket,
Key: opts.remote_path
};
if (opts.acl) params.ACL = opts.acl;
if (opts.content_type) params.ContentType = opts.content_type;
var up = s3.upload(params);
if (opts.progress) up.on('httpUploadProgress', function (data) {
bar.update(data.loaded / size);
});
up.send(callback);
});
};
{
"name": "awsops",
"description": "Interaction with your AWS infrastructure",
"version": "1.0.3",
"version": "1.1.0",
"preferGlobal": true,

@@ -6,0 +6,0 @@ "repository": {

# AWSOPS
[![npm version](https://badge.fury.io/js/awsops.svg)](https://www.npmjs.com/package/awsops)
`awsops` is a simplified CLI utility to help you interact with your AWS infrastructure.

@@ -75,14 +77,15 @@

Commands:
ls List EC2 instances
ssh SSH into an EC2 instance
ls List EC2 instances
ssh SSH into an EC2 instance
s3cp Download/upload a file from/to an S3 bucket
Options:
--auth Optionally use a specified file for authentication
--id Optionally filter by an EC2 instance ID
--name Optionally filter by an EC2 instance's name
--only Optionally return a comma-separated list of fields instead
of rendering a table
--security-group Optionally filter by a security group
--id When using ls or ssh, optionally filter by an EC2 instance ID
--name When using ls or ssh, optionally filter by an EC2 instance's name
--only When using ls or ssh, optionally return a comma-separated list of fields instead of rendering a table
--security-group When using ls or ssh, optionally filter by a security group
--help Show help [boolean]
--verbose Print info/debug statements [count]
-q, --quiet When using s3cp, do not use the progress bar [boolean]
-v, --verbose Print info/debug statements [count]

@@ -92,2 +95,3 @@ Examples:

awsops ssh --name instance-name
awsops s3cp archive.tar.gz s3://my-archive-bucket/archive-2016-08-12.tar.gz

@@ -167,2 +171,22 @@ Got questions? Check out https://github.com/car-throttle/awsops/

### `s3cp`
```
$ awsops s3cp [from] [to]
```
Download from, or upload to, an S3 bucket of your choice. There are a few shortcuts to make it easier to download/upload
files in quick succession:
```
awsops s3cp s3://bucket/path/to/s3-item.txt
=> Download to CURRENT_WORKING_DIRECTORY/s3-item.txt
awsops s3cp s3://bucket/path/to/s3-item.txt folder/something.txt
=> Download to CURRENT_WORKING_DIRECTORY/folder/something.txt
awsops s3cp file.txt s3://bucket/
=> Upload file.txt to s3://bucket/file.txt
awsops s3cp file.txt s3://bucket/somefile.txt
=> Upload file.txt to s3://bucket/somefile.txt
```
## Authentication

@@ -169,0 +193,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc