mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 07:35:38 +00:00
add ec2 list and ssm session fzf script
also fix lint issues on home packages
This commit is contained in:
parent
8b1032ebda
commit
8e88d70a52
21
modules/common/shell/bash/scripts/aws-ec2.sh
Executable file
21
modules/common/shell/bash/scripts/aws-ec2.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Retrieve list of AWS instances
|
||||
# Use enter to jump into their sessions with SSM
|
||||
|
||||
# Specify AWS_PROFILE and AWS_REGION before running this script
|
||||
|
||||
aws ec2 describe-instances |
|
||||
jq -r \
|
||||
'.Reservations[]
|
||||
| .Instances[]
|
||||
| .InstanceId + " - " +
|
||||
(.PrivateIpAddress // "n/a") + " - " +
|
||||
(.PublicIpAddress // "n/a") + " - " +
|
||||
(.Tags | from_entries | .Name // "n/a")' |
|
||||
fzf \
|
||||
--height 100% \
|
||||
--layout reverse \
|
||||
--header $'Press Enter to start SSM session\nInstance ID - Private IP - Public IP - Name' \
|
||||
--preview "aws ec2 describe-instances --instance-ids \"\$(echo {} | cut -d' ' -f1)\" | jq -r '.Reservations[].Instances[0]'" \
|
||||
--bind "enter:become(aws ssm start-session --target \$(echo {} | cut -d' ' -f1))"
|
@ -15,29 +15,38 @@
|
||||
|
||||
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
|
||||
|
||||
home.packages = with pkgs; [
|
||||
visidata # CSV inspector
|
||||
dos2unix # Convert Windows text files
|
||||
inetutils # Includes telnet
|
||||
youtube-dl # Convert web videos
|
||||
pandoc # Convert text documents
|
||||
mpd # TUI slideshows
|
||||
mpv # Video player
|
||||
gnupg # Encryption
|
||||
awscli2
|
||||
ssm-session-manager-plugin
|
||||
awslogs
|
||||
google-cloud-sdk
|
||||
vault-bin
|
||||
consul
|
||||
noti # Create notifications programmatically
|
||||
ipcalc # Make IP network calculations
|
||||
teams
|
||||
(writeShellApplication {
|
||||
home.packages = [
|
||||
pkgs.visidata # CSV inspector
|
||||
pkgs.dos2unix # Convert Windows text files
|
||||
pkgs.inetutils # Includes telnet
|
||||
pkgs.youtube-dl # Convert web videos
|
||||
pkgs.pandoc # Convert text documents
|
||||
pkgs.mpd # TUI slideshows
|
||||
pkgs.mpv # Video player
|
||||
pkgs.gnupg # Encryption
|
||||
pkgs.awscli2
|
||||
pkgs.ssm-session-manager-plugin
|
||||
pkgs.awslogs
|
||||
pkgs.google-cloud-sdk
|
||||
pkgs.vault-bin
|
||||
pkgs.consul
|
||||
pkgs.noti # Create notifications programmatically
|
||||
pkgs.ipcalc # Make IP network calculations
|
||||
pkgs.teams
|
||||
(pkgs.writeShellApplication {
|
||||
name = "ocr";
|
||||
runtimeInputs = [ tesseract ];
|
||||
runtimeInputs = [ pkgs.tesseract ];
|
||||
text = builtins.readFile ../../modules/common/shell/bash/scripts/ocr.sh;
|
||||
})
|
||||
(pkgs.writeShellApplication {
|
||||
name = "ec2";
|
||||
runtimeInputs = [
|
||||
pkgs.awscli2
|
||||
pkgs.jq
|
||||
pkgs.fzf
|
||||
];
|
||||
text = builtins.readFile ../../modules/common/shell/bash/scripts/aws-ec2.sh;
|
||||
})
|
||||
];
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
|
Loading…
Reference in New Issue
Block a user