This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SCRIPT_FOLDER="/opt/scripts" | |
| masterIP=$(docker info --format '{{json .}}' | jq -r .Swarm.RemoteManagers[].Addr | awk -F: 'NR==1{print $1}') | |
| instanceID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
| region=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}') | |
| echo "swarm masetr IP: $masterIP" | |
| env=$(aws ec2 describe-tags --filters "Name=resource-id,Values=${instanceID}" --region $region| jq -r '(.Tags[]|select(.Key=="Environment"))|.Value') | |
| ${SCRIPT_FOLDER}/dyndns53.py -n swarm -s "${env}" -i "${masterIP}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse | |
| deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse | |
| deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse | |
| deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse | |
| deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse | |
| deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse | |
| deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse |
Create a cloud function: Go to Cloud Functions by searching for “Cloud Functions” in search bar:
- Press “create function” button and fill up the form:
Environment: 2nd gen Function name: Region: Choose “Allow unauthorized invocations”