Skip to content

Instantly share code, notes, and snippets.

@AndrewFarley
Last active December 19, 2022 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewFarley/a17f9fdf9a22a93a67faa638532c72d6 to your computer and use it in GitHub Desktop.
Save AndrewFarley/a17f9fdf9a22a93a67faa638532c72d6 to your computer and use it in GitHub Desktop.
Setup AWS on Linux, Amazon Linux, Docker, FSX bash script helper. A scratch pad, I always keep randomly looking this stuff up
#!/bin/bash
# If not AWS Amazon Linux, install awscli...
# https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
# Make sure to install curl groff less, eg:
apt-get install curl groff less
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
amazon-linux-extras install epel -y
yum install joe git -y
# FSX / Lustre
# ref: https://docs.aws.amazon.com/fsx/latest/LustreGuide/install-lustre-client.html
sudo amazon-linux-extras install -y lustre
mkdir /mnt/shared
echo "" >> /etc/fstab
# Generate below from... aws fsx describe-file-systems
echo "fs-0203016af0316d44a.fsx.us-east-2.amazonaws.com@tcp:/k4i7bbmv /mnt/shared lustre defaults,noatime,flock,_netdev,x-systemd.automount,x-systemd.requires=network.service 0 0" >> /etc/fstab
# Install docker support
amazon-linux-extras enable docker
yum -y install docker
systemctl daemon-reload
systemctl enable --now docker
docker run hello-world
# Install docker compose - https://docs.docker.com/compose/install/other/
curl -SL https://github.com/docker/compose/releases/download/v2.14.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose
# Setup docker to login to ECR (works on windows and linux)
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ACCOUNT_ID_REPLACEME.dkr.ecr.us-east-1.amazonaws.com
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ACCOUNT_ID_REPLACEME.dkr.ecr.us-west-2.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment