Skip to content

Instantly share code, notes, and snippets.

View ojacques's full-sized avatar
🌤️
Head in the cloud; feet, too.

Olivier Jacques ojacques

🌤️
Head in the cloud; feet, too.
View GitHub Profile
@ojacques
ojacques / delete-SSM-params.md
Created November 22, 2022 18:10
Delete SSM parameters starting with...

Delete all SSM parameters starting with /XYZ:

aws ssm get-parameters-by-path --path /XYZ --recursive --query 'Parameters[].[Name]' --output text | xargs -n1 -IParam aws ssm delete-parameter --name Param
@ojacques
ojacques / gist:578cce2b77c868e2775f4f64de77a23a
Created January 11, 2023 13:42
AWS delete backup recovery points earlier than a date
VAULT=<your vault here>
for ARN in $(aws backup list-recovery-points-by-backup-vault --backup-vault-name "$VAULT" --query 'RecoveryPoints[].RecoveryPointArn' --output text --region eu-west-1 --by-created-before 1672580151); do
echo "deleting $ARN"
aws backup delete-recovery-point --recovery-point-arn $ARN --region eu-west-1 --backup-vault-name "$VAULT"
done
@ojacques
ojacques / VI.without.VI.in.Docker.container.md
Created January 11, 2023 16:37
Edit a file in Docker container when no editor / vi

Context

I need to edit a file in a Docker container. This container does not have vi or an actual editor. I cannot install anything. I don't have access to run chown either.

Solution

  • Login on the Docker host
  • Get the file from the container: docker cp b28b1d60e423:/the/file/that.I.want.json .
  • Get into the container and find out what is the UID/GID which you want to create the file with (use id)
  • Edit the file on the Docker host
@ojacques
ojacques / README.md
Last active May 11, 2023 21:32
We are ALL DevOps YouTubers now - resources
@ojacques
ojacques / README.md
Created May 24, 2023 17:35
Ressources: Réduire son empreinte carbone 🌳🌻 grâce au cloud ☁️
@ojacques
ojacques / aws-sagemaker-delete-apps.sh
Created October 3, 2023 17:03
List and delete all Amazon SageMaker KernelGateway apps which are still running
aws sagemaker list-apps --query "Apps[?AppType=='KernelGateway' && Status=='InService']" | jq -r '.[] | "\(.AppName) \(.DomainId) \(.UserProfileName)"' | while read AppName DomainId UserProfileName; do echo Deleting $AppName for user $UserProfileName ... && aws sagemaker delete-app --domain-id $DomainId --app-type KernelGateway --app-name $AppName --user-profile $UserProfileName; done
@ojacques
ojacques / README.md
Created February 26, 2024 08:08
Minimal Docker image from AL2023 Amazon Linux 2023

Minimal Docker image from AL2023 Amazon Linux 2023 (in this case, bash and its dependencies)

FROM public.ecr.aws/amazonlinux/amazonlinux:2023 as build
RUN dnf --releasever=$(rpm -q system-release --qf '%{VERSION}') \
  --installroot /sysroot \
  -y \
  --setopt=install_weak_deps=False \
  install bash