Amazon web services 为什么不';我是否创建Amazon Lightsail客户端并设置用户数据?

Amazon web services 为什么不';我是否创建Amazon Lightsail客户端并设置用户数据?,amazon-web-services,Amazon Web Services,为什么我不创建Amazon lightsailclient并设置UserData var shuju = new CreateInstancesRequest() { BlueprintId = "centos_7_1901_01", BundleId = "micro_2_0", AvailabilityZone = "ap-northeast-1d",

为什么我不创建Amazon lightsailclient并设置UserData

var shuju = new CreateInstancesRequest()
            {
                BlueprintId = "centos_7_1901_01",
                BundleId = "micro_2_0",
                AvailabilityZone = "ap-northeast-1d",
                InstanceNames = new System.Collections.Generic.List<string>() { "test" },
                UserData = "echo root:test123456- |sudo chpasswd root\r\nsudo sed -i 's/^#\\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;\r\nsudo sed -i 's/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;\r\nsudo reboot\r\n"
            };
var shuju=new createInstanceRequest()
{
BlueprintId=“centos_7_1901_01”,
BundleId=“micro_2_0”,
AvailabilityZone=“ap-northeast-1d”,
InstanceNames=new System.Collections.Generic.List(){“test”},
UserData=“echo root:test123456-| sudo chpasswd root\r\nsudo sed-i's/^ permitrotlogin.*/permitrotlogin yes/g'/etc/ssh/sshd\u config;\r\nsudo sed-i's/^ PasswordAuthentication yes/g'/etc/ssh/sshd\u config;\r\n重新启动\r\n”
};

如果希望在Linux实例上运行用户数据脚本,那么第一行必须以
#开头

它使用与Amazon EC2实例相同的技术,因此请参见: