Skip to content

Instantly share code, notes, and snippets.

@nyetwurk
Created August 10, 2018 16:03
Show Gist options
  • Save nyetwurk/9c1323f27fd8fd7b72382b3af17cd070 to your computer and use it in GitHub Desktop.
Save nyetwurk/9c1323f27fd8fd7b72382b3af17cd070 to your computer and use it in GitHub Desktop.

Revisions

  1. nyetwurk created this gist Aug 10, 2018.
    41 changes: 41 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/bin/bash
    HERE=$(dirname $0)
    SED="sed -r s/[[:blank:]]+/,/g"
    function lxd-images()
    {
    # snap install lxd
    lxc image list -c fl --format csv
    }

    # Google
    function goc-images()
    {
    # https://cloud.google.com/sdk/docs/#install_the_latest_cloud_tools_version_cloudsdk_current_version
    gcloud compute images list --project=blockdaemon-development --filter=local-dev | $SED
    }

    # Amazon
    function aws-images()
    {
    # sudo aptitude install awscli
    for region in `aws ec2 describe-regions --output text | cut -f3`; do
    OUT=$(aws ec2 describe-images --owners=self --filters Name=name,Values="*-local-dev-*" --output text --region $region | grep IMAGES | cut -f6,9,10 | $SED)
    if [ ! -z "$OUT" ]; then
    echo "$OUT,$region"
    fi
    done
    }

    # Digital ocean
    function doc-images()
    {
    # snap install doctl
    doctl compute image list --format ID,Name | grep -- -local-dev- | $SED
    }

    function arts-images()
    {
    pushd $HERE/.. > /dev/null
    ./task-run.sh cloudarts list vmimage 2>/dev/null | $SED
    popd > /dev/null
    }