Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion aliases
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ alias images='~/.bash-my-aws/bin/bma images'
alias instance-asg='~/.bash-my-aws/bin/bma instance-asg'
alias instance-az='~/.bash-my-aws/bin/bma instance-az'
alias instance-console='~/.bash-my-aws/bin/bma instance-console'
alias instance-change-type='~/.bash-my-aws/bin/bma instance-change-type'
alias instance-dns='~/.bash-my-aws/bin/bma instance-dns'
alias instance-health-set-unhealthy='~/.bash-my-aws/bin/bma instance-health-set-unhealthy'
alias instance-iam-profile='~/.bash-my-aws/bin/bma instance-iam-profile'
Expand Down Expand Up @@ -167,4 +168,4 @@ function region() {
else
AWS_DEFAULT_REGION="$inputs";
fi
}
}
22 changes: 22 additions & 0 deletions lib/instance-functions
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ instances() {
column -s$'\t' -t
}

instance-change-type() {

# Change an instance type
#
# USAGE: instance-change-type instance-type instance-id [instance-id]

[[ $# != 2 ]] && __bma_usage "instance-change-type instance-type instance-id [instance-id]" && return 1
local type=$1
shift
local instance_ids=$(skim-stdin "$@")
local regex_yes="^[Yy]$"

read -p "Are you sure you want to change these instances to $type? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
for id in $instance_ids; do
aws ec2 modify-instance-attribute \
--instance-type $type \
--instance-id $id
done
fi
}

instance-asg() {

Expand Down