File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ instances() {
3838 VpcId
3939 ]" |
4040 grep -E -- " $filters " |
41- LC_ALL=C sort -b -k 6 |
41+ LC_ALL=C sort -t $' \t ' -k 6 |
4242 columnise
4343}
4444
@@ -219,6 +219,36 @@ instance-ip() {
219219 columnise
220220}
221221
222+ instance-profile () {
223+ local instance_ids=$( skim-stdin " $@ " )
224+ [[ -z $instance_ids ]] && __bma_usage " instance-id [instance-id]" && return 1
225+
226+ aws ec2 describe-instances \
227+ --instance-ids ${instance_ids} \
228+ --query " Reservations[].Instances[].[
229+ IamInstanceProfile.Arn,
230+ IamInstanceProfile.Id,
231+ InstanceId
232+ ]" \
233+ --output text|
234+ awk -F' \t' -v OFS=' \t' ' {split($1,a,"/"); $1=a[length(a)]; print $0}' |
235+ columnise
236+ }
237+
238+ instance-profile-role () {
239+
240+ local instance_profile_names=$( skim-stdin " $@ " )
241+ [[ -z $instance_profile_names ]] && __bma_usage " instance-profile-name [instance-profile-name]" && return 1
242+
243+ local instance_profile_name
244+ for instance_profile_name in $instance_profile_names ; do
245+ aws iam get-instance-profile \
246+ --instance-profile-name " ${instance_profile_name} " \
247+ --query " InstanceProfile.Roles[0].RoleName" \
248+ --output text
249+ done
250+ }
251+
222252instance-ssh () {
223253
224254 # Establish SSH connection to EC2 Instance(s)
You can’t perform that action at this time.
0 commit comments