From bcb30fe25d05730016be241da8bd322282795051 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: May 11 2022 02:51:43 +0000 Subject: README: add example bringup commands for EC2 --- diff --git a/README.md b/README.md index 129fd8b..152cb30 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,44 @@ HISTCONTROL='ignoreboth' cat archive-repo-manager.bu | envsubst | butane --pretty > archive-repo-manager.ign ``` -Then launch the FCOS machine with the `archive-repo-manager.ign`. After -logging in you can switch to the `worker` user and monitor the systemd user -units: +Then launch the FCOS machine with the `archive-repo-manager.ign`. Here +is an example doing that in AWS: + +``` +# Add your credentials for EC2 to the environment +HISTCONTROL='ignoreboth' + export AWS_DEFAULT_REGION=us-east-1 + export AWS_ACCESS_KEY_ID=XXXX + export AWS_SECRET_ACCESS_KEY=YYYYYYYY + +# Bring the instance up with appropriate details +NAME='archive-repo-manager' +AMI='ami-0560e1583a204b92b' +TYPE='t4g.medium' +DISK='20' +SUBNET='subnet-0732e4cda7466a2ae' +SECURITY_GROUPS='sg-7d0b4c05' +USERDATA="${PWD}/archive-repo-manager.ign" +aws ec2 run-instances \ + --output json \ + --image-id $AMI \ + --instance-type $TYPE \ + --subnet-id $SUBNET \ + --security-group-ids $SECURITY_GROUPS \ + --user-data "file://${USERDATA}" \ + --tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=${NAME}}]" \ + --block-device-mappings "VirtualName=/dev/xvda,DeviceName=/dev/xvda,Ebs={VolumeSize=${DISK},VolumeType=gp3}" \ + > out.json + +# Get IP and ssh in +INSTANCE=$(jq --raw-output .Instances[0].InstanceId out.json) +IP=$(aws ec2 describe-instances --instance-ids $INSTANCE --output json \ + | jq -r '.Reservations[0].Instances[0].PublicIpAddress') +ssh "core@${IP}" +``` + +After logging in you can switch to the `worker` user and monitor the systemd +user units: ``` sudo machinectl shell worker@