curl http://169.254.169.254/latest/dynamic/instance-identity/document
----------------------不用密钥对登陆
#!/bin/bash
#Turn on password authentication for lab challenge
echo ‘abc@123’ | passwd --stdin root
sed -i ‘s|[#]*PasswordAuthentication no|PasswordAuthentication yes|g’ /etc/ssh/sshd_config
sed -i ‘s|PermitRootLogin forced-commands-only|PermitRootLogin yes|g’ /etc/ssh/sshd_config
service sshd restart
systemctl restart sshd
------------------------安装httpd和mysql
yum -y install httpd
service httpd restart
systemctl restart httpd
yum install mysql
yum install mysql-server
yum install mysql-devel
chgrp -R mysql /var/lib/mysql
chmod -R 770 /var/lib/mysql
service mysqld start
/usr/bin/mysqladmin -u root password ‘123’
------------------安装docker
yum update -y
yum install -y docker
service docker start
usermod -a -G docker ec2-user
yum install -y git
git clone https://github.com/awslabs/ecs-demo-php-simple-app
cd ecs-demo-php-simple-app
docker build -t yg-test .
docker run -p 80:81 yg-test
---------------------ec2远程连接RDS
#!/bin/bash
yum install -y httpd mysql*
amazon-linux-extras install -y php7.2
wget https://us-west-2-tcprod.s3.amazonaws.com/courses/ILT-TF-100-ARCHIT/v6.3.4/lab-2-webapp/scripts/inventory-app.zip
unzip inventory-app.zip -d /var/www/html/
wget https://github.com/aws/aws-sdk-php/releases/download/3.62.3/aws.zip
unzip aws -d /var/www/html
chkconfig httpd on
service httpd restart
--------------------显示实例ID
#!/bin/bash
#Turn on password authentication for lab challenge
echo ‘abc@123’ | passwd --stdin root
sed -i ‘s|[#]*PasswordAuthentication no|PasswordAuthentication yes|g’ /etc/ssh/sshd_config
sed -i ‘s|PermitRootLogin forced-commands-only|PermitRootLogin yes|g’ /etc/ssh/sshd_config
service sshd restart
systemctl restart sshd
yum -y install httpd
service httpd restart
systemctl restart httpd
echo “