0
如何在通过CLI进行引导期间在Ubuntu EC2实例上安装软件包。使用Userdata可能吗?如何在引导CLI的同时在EC2 ubuntu机器上安装软件包?
如何在通过CLI进行引导期间在Ubuntu EC2实例上安装软件包。使用Userdata可能吗?如何在引导CLI的同时在EC2 ubuntu机器上安装软件包?
是的,用户数据在Ubuntu上受支持。他是如何通过构建出一个新的实例时,它看起来的一个例子:实例可用
$ cat > init.sh
apt-get -y install mypackage
^D
$ aws ec2 run-instances \
--iam-instance-profile Name=my-ec2-profile \
--image-id ami-fa82739a \
--count 1 \
--instance-type t2.nano \
--key-name my-ssh-key \
--security-groups my-security-group \
--user-data file://init.sh
后,您可以检查日志,以确保程序包安装工作正常:
$ ssh -i my-ssh-key.pem [email protected]
$ cat /var/log/cloud-init-output.log
是它有可能通过Userdata。 –
ssh -i /tmp/xxxxx.pem -o“StrictHostKeyChecking no”ubuntu @ $ {PUBLIC_IP}“sudo apt-get install python -y” –