gpt4 book ai didi

amazon-web-services - 我正在尝试使用 aws-cli 启动一个 ec2 实例(即 ubuntu ami),并且我想从我之前创建的 s3 存储桶中复制我的代码

转载 作者:行者123 更新时间:2023-12-04 18:31:42 25 4
gpt4 key购买 nike

这是我用来启动我的 ec2 实例的命令:
aws ec2 run-instances --image-id *ubuntu image id* --count 1 --instance-type t2.micro --key-name new_instance --security-group-ids mysecuity --user-data file://aws.txt
我的 aws.txt 文件内容:

`#!/bin/bash
sudo apt-get update
sudo apt-get install -y apache2 php7.0 php7.0-curl php7.0-cli
sudo service apache2 start
sudo apt-get install -y python3 python-pip
sudo apt-get update && sudo pip install --upgrade --user awscli
mkdir ~/.aws && cd ~/.aws
touch credentials && touch config
echo "[default]" > credentials
echo "aws_access_key_id = *id here*" >> credentials
echo "aws_secret_access_key = *secret key*" >> credentials
echo "[default]" > config
echo "output = json" >> config
echo "region = ap-south-1" >> config`enter code here`
sudo aws s3 sync s3://*bucket name* var/www/html`

但只有 apache2 和 php 正在安装。并且 mkdir 没有工作并且没有安装 awscli,因此我的 s3 存储桶代码没有与我的 ebs 卷同步。

最佳答案

它可能会在 mkdir ~/.aws && cd ~/.aws 上引发错误行,因为“~”有时指的是不同的位置而不是使用 mkdir /home/*username here*/.aws && cd /home/*username here*/.aws .它应该可以工作并尝试在最后一行 aws 中使用 sudo。

关于amazon-web-services - 我正在尝试使用 aws-cli 启动一个 ec2 实例(即 ubuntu ami),并且我想从我之前创建的 s3 存储桶中复制我的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49383734/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com