Skip to content

Instantly share code, notes, and snippets.

@mikepfeiffer
Last active January 21, 2024 20:37
Show Gist options
  • Select an option

  • Save mikepfeiffer/7c949e2d04c9e51ef204fb9a7f3d2978 to your computer and use it in GitHub Desktop.

Select an option

Save mikepfeiffer/7c949e2d04c9e51ef204fb9a7f3d2978 to your computer and use it in GitHub Desktop.

Revisions

  1. mikepfeiffer revised this gist Aug 26, 2016. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    #!/bin/bash
    yum update -y
    yum install httpd -y
    /sbin/chkconfig --levels 235 httpd on
    service httpd start
  2. mikepfeiffer revised this gist Aug 26, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #!/bin/bash
    yum update -y
    yum install httpd -y
    /sbin/chkconfig --levels 235 httpd on
    service httpd start
    instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
    region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
  3. mikepfeiffer created this gist Aug 26, 2016.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #!/bin/bash
    yum install httpd -y
    service httpd start
    instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
    region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
    echo "<h1>$instanceId</h1>" > /var/www/html/index.html
    aws ec2 create-tags --resources "$instanceId" --tags Key=Name,Value="PROD-$instanceId" --region "$region"