This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source_ami=ami-xxxxxxx | |
dest_ami=ami-yyyyyyy | |
aws ec2 modify-image-attribute \ | |
--image-id ${dest_ami} \ | |
--attribute launchPermission \ | |
--operation-type add \ | |
--user-ids $(aws ec2 describe-image-attribute --image-id ${source_ami} --attribute launchPermission \ | |
| jq -r '.LaunchPermissions[].UserId' | tr '\n' ' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
taskDefinitionName=$1 | |
OPTS="" | |
definition=$(aws ecs describe-task-definition --task-definition ${taskDefinitionName} | jq '.taskDefinition.containerDefinitions[0]') | |
image=$(echo $definition | jq -r '.image') | |
# envvar | |
OPTS="${OPTS}$(echo $definition | jq -r '.environment[] | "-e \(.name)=\"\(.value)\""' | tr '\n' ' ')" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby -rjson -ryaml -e 'Dir.glob("*.json").map{ |f| File.write(f, YAML.dump(JSON.parse(File.read(f)))) }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
ec2 = Aws::EC2::Resource.new | |
kv = ec2.instances.each do |i| | |
begin | |
name = i.tags.find{|t| t["key"] == "Name" }.value | |
rescue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
require 'optparse' | |
require 'yaml' | |
require 'json' | |
begin | |
require 'aws/profile_parser' | |
rescue LoadError; end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
require 'optparse' | |
begin | |
require 'aws/profile_parser' | |
rescue LoadError; end | |
def conv_unit size |