#cloud-storage #save-file #nushell #google-cloud #nushell-plugin #aws #storage-service

bin+lib nu_plugin_cloud

A nushell plugin for working with cloud storage services

4 releases

0.2.2 Nov 16, 2024
0.2.1 Oct 30, 2024
0.2.0 Sep 26, 2024
0.1.0 Aug 23, 2024

#2027 in Web programming

Download history 15/week @ 2024-08-17 168/week @ 2024-08-24 4/week @ 2024-08-31 17/week @ 2024-09-14 171/week @ 2024-09-21 40/week @ 2024-09-28 5/week @ 2024-10-05 1/week @ 2024-10-12 108/week @ 2024-10-26 18/week @ 2024-11-02 1/week @ 2024-11-09 114/week @ 2024-11-16 5/week @ 2024-11-23

148 downloads per month

MIT and maybe CC-PDDC

47KB
1K SLoC

nu_plugin_cloud

Provides uniform access to cloud storage services for nushell.

Features

  • cloud ls - List the filenames, sizes, modificationtime , etags, and versions of a cloud location.
  • cloud open - Load a file into a cell, converting to table if possible (avoid by appending '--raw').
  • cloud rm - Remove a file from cloud sotrage
  • cloud save - Save a file to cloud storage
  • AWS S3 support
  • Coming Soon: Azure support
  • Coming Soon: Google cloud support

Installation

Prerequisites

Installation With Cargo

cargo install nu_plugin_cloud
plugin add ~/.cargo/bin/nu_plugin_cloud
plugin use cloud

Installation From Source

git clone https://github.com/ayax79/nu_plugin_cloud.git
cd nu_plugin_cloud
cargo install --path .
plugin add ~/.cargo/bin/nu_plugin_cloud
plugin use cloud

[!TIP] This plugin will turn of plugin GC when any operation happens.

To turn plugin GC back off and query internal caches, run:

cloud cache-clear

AWS Support

AWS Setup

Configuration for AWS uses the standard Configuration and Credential Files. To change your profile, ensure that the AWS_PROFILE environment variable is set to the desired profile.

AWS SSO

For SSO, the AWS CLI is required to configure and login. To setup AWS SSO:

This plugin uses the aws_config crate. It is very unforgiving of miss configurations.

It will work if the profile includes only the sso_session, sso_account_id, and sso_role_name. Don't include sso_start_url in the profile section for instance.

[profile my-profile]
sso_session = my-sso
sso_account_id = <numeric account id>
sso_role_name = my-iam-role
region = us-east-1
output = json

[sso-session my-sso]
sso_start_url = https://d-92677e5ab0.awsapps.com/start
sso_region = us-west-2
sso_registration_scopes = sso:account:access

Non-Cloud Storage

There are two types of supported non-cloud storage types, in-memory and file system. It can be useful to use these for testing purposes.

In-Memory Usage

Save a file from memory:

[[a b]; [1 2]] | cloud save memory:/foo.csv

Load a file from memory:

cloud open memory:/foo.csv

List files in memory:

cloud ls memory:/foo.csv

Filesystem Usage

Save a file from the local filesystem:

[[a b]; [1 2]] | cloud save file:///tmp/test/foo.csv

Load a file from the local filesystem:

cloud open file:///tmp/test/foo.csv

List files in the local filesystem:

cloud ls file:///tmp/test/foo.csv

Dependencies

~62–96MB
~2M SLoC