Skip to content

Instantly share code, notes, and snippets.

@m-bers
Last active July 21, 2022 18:41
Show Gist options
  • Save m-bers/83903dad7b36b23038d06a3ce185e56c to your computer and use it in GitHub Desktop.
Save m-bers/83903dad7b36b23038d06a3ce185e56c to your computer and use it in GitHub Desktop.
# UDF Console steps:
# In the sidebar, click Deployments, then click Create Deployment in the top right
# Set provider to UDF and give the deployment a name
# Open the new deployment, click "Cloud Accounts", then "Add AWS Cloud Account"
# Click Components, then Systems, then Add.
# Choose template Ubuntu 20.04 LTS Server
# Set to 4 vCPUs, 15GB RAM, 370GB Disk, then click Create
# Click start, and select n1-standard-4 as the deployment size
# SSH into the Ubuntu VM once started
# Set up AWS CLI
sudo apt-get update && sudo apt-get -y install unzip jq git curl
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
# Set up AWS credentials in UDF
mkdir ~/.aws
printf "[default]\naws_access_key_id=" > ~/.aws/credentials
curl -s 10.1.1.1/cloudAccounts | jq '.cloudAccounts[0]' | jq -r ' .apiKey' >> ~/.aws/credentials
printf "aws_secret_access_key=" >> ~/.aws/credentials
curl -s 10.1.1.1/cloudAccounts | jq '.cloudAccounts[0]' | jq -r ' .apiSecret' >> ~/.aws/credentials
printf "[default]\nregion=us-west-2" > ~/.aws/config
# Create and import ssh key
ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N ""
aws ec2 import-key-pair --key-name udf --public-key-material fileb:///$HOME/.ssh/id_rsa.pub
# Create BIG-IP password secret
BIGIP_PASSWORD_ARN=$(aws secretsmanager create-secret --region us-west-2 --name mySecretId --secret-string 'BIGIP#Passw0rd' | jq -r ' .ARN')
# Set up CFT
git clone https://github.com/F5Networks/f5-aws-cloudformation-v2.git
cd f5-aws-cloudformation-v2/examples/failover
cat <<EOF >>parameters.json
[
{
"ParameterKey": "restrictedSrcAddressMgmt",
"ParameterValue": "0.0.0.0/0"
},
{
"ParameterKey": "restrictedSrcAddressApp",
"ParameterValue": "0.0.0.0/0"
},
{
"ParameterKey": "secretArn",
"ParameterValue": "$BIGIP_PASSWORD_ARN"
},
{
"ParameterKey": "sshKey",
"ParameterValue": "udf"
},
{
"ParameterKey": "provisionPublicIpMgmt",
"ParameterValue": "false"
},
{
"ParameterKey": "provisionExampleApp",
"ParameterValue": "false"
},
{
"ParameterKey": "cfeS3Bucket",
"ParameterValue": "j-chambers-bigip-high-availability-solution"
}
]
EOF
# Deploy CFT
aws cloudformation create-stack \
--region us-west-2 \
--stack-name bigip-cft2-failover \
--template-body file://failover.yaml \
--parameters file://parameters.json \
--capabilities CAPABILITY_IAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment