我想设置2个ECS集群:TEST和PROD。 要允许EC2实例成为群集的一部分,您需要使ECS代理与ECS角色一起运行。如何确保DEV和PROD在分离的服务器(实例)上运行?
答案 0 :(得分:1)
将以下代码粘贴到EC2用户数据部分:
if (!empty($_FILES['file'])=="") {
$sql="INSERT INTO tabletry (title, location)
VALUES ('".addslashes($title)."', '".addslashes($location)."')";
} else {
$ext = pathinfo($_FILES['file']['name'])['extension'];
$nFn = generateRandomString(). ".$ext";
move_uploaded_file($_FILES['file']['tmp_name'],"pictures/".$nFn);
function generateRandomString($legnth = 10) {
return substr(str_shuffle("abcdefghijklmnopqrstuvwxyz"),0, $legnth);
}
$sql="INSERT INTO tabletry (title, location, mainimage)
VALUES ('".addslashes($title)."', '".addslashes($location)."', '{$nFn}')";
}
来源:http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html