Following up from the previous post, many folks succeeded in grabbing an account in a pure China environment, only to get stuck at the “insufficient configuration” step. Today, let’s fill that gap and share this fully cloud-based GitHub Actions auto-instance sniping script — no local machine required at all.
3. Cloud-only Instance Sniping Setup Steps
- Create a New Repository: Create a new private repository under your own GitHub account (Private Repository).
- Set Up Secure Environment Variables (Secrets): Go to the repository’s Settings → Secrets and variables → Actions, click New repository secret, and carefully add the following 7 credentials one by one according to the variable names in the code:
TENANCY_OCID(Oracle Tenancy ID)USER_OCID(Oracle User ID)REGION(Server region, e.g.us-phoenix-1)FINGERPRINT(Oracle API key fingerprint)PRIVATE_KEY(Full text of your Oracle API private key)SUBNET_ID(Subnet ID in the target virtual cloud network)USER_SSH_PUB_KEY(Your computer’s SSH public key; this must be set correctly or you won’t be able to SSH in even if you get a server)
- Deploy the Code: In the repository root, create a
.github/workflows/folder, add a new.ymlfile (for example,sniper.yml), paste the entire code below into it, and commit it. - Trigger the Workflow: The code includes a
workflow_dispatchtrigger, so you can go to the Actions panel on GitHub and simply click Run workflow to start the script. It’s also configured with acronschedule, so it’ll automatically try every 15 minutes in the background, with a 45 minute timeout to safely exit and minimize bans.
Note: By default, the script tries to grab Ubuntu 24.04. If you want to install a different OS, just modify the query on line 40 of the code.
4. Complete GitHub Actions Source Code
Click to expand and view the sniper.yml source
name: Oracle ARM Instance Sniper Template
on:
workflow_dispatch:
schedule:
- cron: '*/15 * * * *'
jobs:
sniper:
name: ARM Instance Sniper
runs-on: ubuntu-latest
timeout-minutes: 60
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
env:
OCI_TENANCY: ${{ secrets.TENANCY_OCID }}
OCI_REGION: ${{ secrets.REGION }}
SUBNET_ID: ${{ secrets.SUBNET_ID }}
SSH_PUB_KEY: ${{ secrets.USER_SSH_PUB_KEY }}
steps:
- name: Install OCI CLI
run: |
curl -L -O [https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh](https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)
chmod +x install.sh
./install.sh --accept-all-defaults
echo "/home/runner/bin" >> $GITHUB_PATH
- name: Setup OCI Config
env:
OCI_USER: ${{ secrets.USER_OCID }}
OCI_FP: ${{ secrets.FINGERPRINT }}
OCI_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
run: |
mkdir -p ~/.oci
cat > ~/.oci/config <<EOF
[DEFAULT]
user=${OCI_USER}
fingerprint=${OCI_FP}
tenancy=${OCI_TENANCY}
region=${OCI_REGION}
key_file=~/.oci/key.pem
EOF
echo "${OCI_PRIVATE_KEY}" > ~/.oci/key.pem
chmod 600 ~/.oci/key.pem ~/.oci/config
- name: Fixed-Key Sentry Loop
run: |
export OCI_CLI_SUPPRESS_FILE_PERMISSIONS_WARNING=True
START_TIME=$(date +%s)
mkdir -p ~/.ssh
echo "${SSH_PUB_KEY}" > ~/.ssh/id_rsa_oracle.pub
AD_LIST=$(oci iam availability-domain list --compartment-id "${OCI_TENANCY}" --query "data[*].name" --raw-output | jq -r '.[]' | sort)
IMAGE_ID=$(oci compute image list --compartment-id "${OCI_TENANCY}" --operating-system "Canonical Ubuntu" --operating-system-version "24.04" --shape "VM.Standard.A1.Flex" --query 'data[0].id' --raw-output)
echo "=== Oracle ARM Sniper Template V1.0 ==="
echo "[AD] Target ADs: $(echo $AD_LIST | tr '\n' ' ')"
echo "[IMG] Target Image: ${IMAGE_ID}"
while true; do
CURRENT_TIME=$(date +%s)
ELAPSED=$(( CURRENT_TIME - START_TIME ))
if [ $ELAPSED -gt 2700 ]; then
echo "[TIMEOUT] Reached 45m limit. Exiting safely."
exit 0
fi
for ad in $AD_LIST; do
echo "[TRY] $ad | Elapsed: ${ELAPSED}s"
if oci compute instance launch \
--availability-domain "$ad" \
--compartment-id "${OCI_TENANCY}" \
--shape "VM.Standard.A1.Flex" \
--shape-config '{"ocpus":4,"memoryInGBs":24}' \
--image-id "$IMAGE_ID" \
--subnet-id "${SUBNET_ID}" \
--ssh-authorized-keys-file ~/.ssh/id_rsa_oracle.pub \
--assign-public-ip true \
--display-name "SNIPER-$(date +%m%d_%H%M)" \
--wait-for-state RUNNING --max-wait-seconds 1 \
>/dev/null 2>/dev/null; then
echo "[SUCCESS] ARM 4C24G instance created in $ad"
exit 0
else
echo "$ad: No stock"
fi
sleep 5
done
sleep 30
done
5. I wish you all the best in getting your free 2-core 12GB ‘super server’ soon!
