> ec2metadata --instance-id

is simpler.