pilasguru icon

user-data-basic

pilasguru | PRO | 09/08/25 06:00:06 PM UTC (Edited) | 0 ⭐ | 5536 πŸ‘οΈ | Never ⏰ | []
Bash |

470 B

|

Source Code

|

0 πŸ‘

/

0 πŸ‘Ž

#!/bin/bash
# AWS Amazon Linux 2 
yum install -y nginx
systemctl start nginx
systemctl enable nginx
TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
PH=`curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/public-hostname`
echo "<body style='background-color:rgb($((RANDOM%256)),$((RANDOM%256)),$((RANDOM%256)))'>This is my instance ${PH}</body>" > /usr/share/nginx/html/index.html

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž