github.com/swisspost/terratest@v0.0.0-20230214120104-7ec6de2e1ae0/examples/terraform-remote-exec-example/files/get-public-ip.sh (about)

     1  #!/bin/bash
     2  
     3  # For example purposes, print the public IP address of this instance. This example uses Instance Metadata Service version 2.
     4  TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") \
     5  && curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/meta-data/public-ipv4