ec2id #1

  • //
  • p4-sdp/
  • r26.1.0.BETA/
  • Server/
  • Unix/
  • p4/
  • common/
  • cloud/
  • aws/
  • bin/
  • ec2id
  • View
  • Commits
  • Open Download .zip Download (738 B)
#!/bin/bash
set -u

# This is the cheater's trick to get the AWS EC2 Instance ID.
EC2_InstanceID=$(readlink /var/lib/cloud/instance)
EC2_InstanceID=${EC2_InstanceID##*/}
[[ -n "$EC2_InstanceID" ]] && echo "$EC2_InstanceID"

# For reference, this is a more "official" way to get an AWS EC2 Instance ID.
### TOKEN=$(curl -sS -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") 2>/dev/null
### EC2_InstanceID=$(curl -sS -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id)
### echo "$EC2_InstanceID"

# Tip: The /var/lib/cloud/instances directory does not get cleaned up during AMI
# create/restore process.  It can contain multiple obsolete instance IDs.
# Change User Description Committed
#1 33444 Claude (AI Agent by Anthropic) Initial population of r26.1.0.BETA from main.
//p4-sdp/main/Server/Unix/p4/common/cloud/aws/bin/ec2id
#1 33433 Claude (AI Agent by Anthropic) Copy Up from //p4-sdp/dev into //p4-sdp/main.

This is the first-ever population of main under the new Streams-based
depot structure -- main has held zero files/history until now, since no
release has ever gone through this process before. 463 files, covering
the entire 2026.1 cycle: rebranding (SDP-1379), Secure By Default
(SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword version
identification (SDP-1161/SDP-799), the Streams-native release process
redesign itself (Task 5), the opt_perforce_sdp_backup.sh false-error fix,
the P4D 2026.1 test-suite targeting, refreshed P4*.json files, and the
fixed-main-URL/isolate-downloads tarball design -- everything accumulated
in dev's history to date. Isolated paths (ai_dev_support/, Version,
doc/*.html, doc/*.pdf, doc/gen/*.man.txt, doc/gen/sdp_install.cfg,
Unsupported/doc/*.html, Unsupported/doc/*.pdf, downloads/) correctly did
not come along -- each stream maintains those independently by design.

Per the Merge Down/Copy Up flow (Step 9 confirmed clean, nothing to
merge), this is an unconditional, all-or-nothing copy of dev's content --
this is the first Streams-based SDP release, being rehearsed step by step
per the release process doc.

Agent: Claude Code, Model: Claude Sonnet 5 (claude-sonnet-5), operating as bot_Claude_Anthropic.
//p4-sdp/dev/Server/Unix/p4/common/cloud/aws/bin/ec2id
#1 31913 C. Thomas Tyler p4 merge -b SDP_Classic_to_Streams
  p4 resolve -as
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/cloud/aws/bin/ec2id
#2 31877 C. Thomas Tyler Tweaked ec2id.
#1 31876 C. Thomas Tyler Better location for this script, and fixed it.
//guest/perforce_software/sdp/dev/Unsupported/Samples/bin/ec2id
#1 31875 C. Thomas Tyler Added utility to get EC2 instance id.