Set up a ubuntu dev machine in AWS.
- aws-vault
brew install aws-vault
[usage] - terraform
brew install terraform
- python3
brew install python3
Fork this repo and clone locally. Then run:
./bin/setup
./bin/create
./bin/destroy
git pull upstream main
python3 -m venv env && \
source env/bin/activate && \
pip3 install ansible && \
ansible-galaxy install diodonfrost.terraform && \
ansible-galaxy install darkwizard242.awsvault
cp .env.example .env
terraform init
ssh-keygen -t ed25519 -N '' -f ./key
source env/bin/activate
source ./.env
aws-vault exec $DM_AWS_VAULT_ROLE -- \
terraform plan \
-var "instance_type=$DEVMACHINE_INSTANCE_TYPE" \
-var "ami=$DEVMACHINE_AMI" \
-var "vpc_id=$DEVMACHINE_VPC_ID" \
-var "name=$DEVMACHINE_NAME" \
-var "subnet=$DEVMACHINE_SUBNET" \
-var "kms_key_arn=$DEVMACHINE_KMS_KEY_ARN"a
aws-vault exec $DM_AWS_VAULT_ROLE -- \
terraform apply \
-var "instance_type=$DEVMACHINE_INSTANCE_TYPE" \
-var "ami=$DEVMACHINE_AMI" \
-var "vpc_id=$DEVMACHINE_VPC_ID" \
-var "name=$DEVMACHINE_NAME" \
-var "subnet=$DEVMACHINE_SUBNET" \
-var "kms_key_arn=$DEVMACHINE_KMS_KEY_ARN"
aws-vault exec $DM_AWS_VAULT_ROLE -- \
terraform destroy \
-auto-approve \
-var "instance_type=$DEVMACHINE_INSTANCE_TYPE" \
-var "ami=$DEVMACHINE_AMI" \
-var "vpc_id=$DEVMACHINE_VPC_ID" \
-var "name=$DEVMACHINE_NAME" \
-var "subnet=$DEVMACHINE_SUBNET" \
-var "kms_key_arn=$DEVMACHINE_KMS_KEY_ARN"
terraform state show aws_instance.instance
terraform output -raw ip
# trailing comma is required to specify ip list
DM_IP=$(terraform output -raw ip)
DEVMACHINE_HOST="$DM_IP,"
ansible-playbook \
--private-key "$(pwd)/key" \
-i $DEVMACHINE_HOST \
playbooks/ssh.yaml
ssh "ubuntu@$DEVMACHINE_HOST"
https://stormssh.readthedocs.io/en/latest/index.html
pip3 install stormssh
storm add $DEVMACHINE_NAME ubuntu@$DM_IP
# or update
storm edit $DEVMACHINE_NAME ubuntu@$DM_IP
storm delete $DEVMACHINE_NAME
ssh "ubuntu@$DEVMACHINE_NAME"
ansible-playbook \
-i "$DEVMACHINE_NAME," \
playbooks/upgrade.yaml
ansible-playbook \
-i "$DEVMACHINE_NAME," \
playbooks/workspace.yaml
ansible-playbook \
-i "$DEVMACHINE_NAME," \
playbooks/nvm.yaml
ansible-playbook \
-i "$DEVMACHINE_NAME," \
playbooks/packages.yaml
ansible-galaxy install diodonfrost.terraform
ansible-playbook \
-i "$DEVMACHINE_NAME," \
playbooks/terraform.yaml
ansible-galaxy install darkwizard242.awsvault
ansible-playbook \
-i "$DEVMACHINE_NAME," \
playbooks/aws-vault.yaml
ssh-add -K ~/.ssh/id_ed25519