mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 13:25: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-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = [
|
||||||
visidata # CSV inspector
|
pkgs.visidata # CSV inspector
|
||||||
dos2unix # Convert Windows text files
|
pkgs.dos2unix # Convert Windows text files
|
||||||
inetutils # Includes telnet
|
pkgs.inetutils # Includes telnet
|
||||||
youtube-dl # Convert web videos
|
pkgs.youtube-dl # Convert web videos
|
||||||
pandoc # Convert text documents
|
pkgs.pandoc # Convert text documents
|
||||||
mpd # TUI slideshows
|
pkgs.mpd # TUI slideshows
|
||||||
mpv # Video player
|
pkgs.mpv # Video player
|
||||||
gnupg # Encryption
|
pkgs.gnupg # Encryption
|
||||||
awscli2
|
pkgs.awscli2
|
||||||
ssm-session-manager-plugin
|
pkgs.ssm-session-manager-plugin
|
||||||
awslogs
|
pkgs.awslogs
|
||||||
google-cloud-sdk
|
pkgs.google-cloud-sdk
|
||||||
vault-bin
|
pkgs.vault-bin
|
||||||
consul
|
pkgs.consul
|
||||||
noti # Create notifications programmatically
|
pkgs.noti # Create notifications programmatically
|
||||||
ipcalc # Make IP network calculations
|
pkgs.ipcalc # Make IP network calculations
|
||||||
teams
|
pkgs.teams
|
||||||
(writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "ocr";
|
name = "ocr";
|
||||||
runtimeInputs = [ tesseract ];
|
runtimeInputs = [ pkgs.tesseract ];
|
||||||
text = builtins.readFile ../../modules/common/shell/bash/scripts/ocr.sh;
|
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 = {
|
programs.fish.shellAbbrs = {
|
||||||
|
Loading…
Reference in New Issue
Block a user