Amazon web services ssh到amazon ubuntu实例
当我从amazon web控制台创建amazon ubuntu实例并尝试使用ssh从任何远程计算机登录到该实例时,我可以登录,但当我使用ansible aws.yml文件创建ec2实例并尝试执行相同操作时,我无法连接,并收到一个错误Amazon web services ssh到amazon ubuntu实例,amazon-web-services,amazon-ec2,ssh,ansible,Amazon Web Services,Amazon Ec2,Ssh,Ansible,当我从amazon web控制台创建amazon ubuntu实例并尝试使用ssh从任何远程计算机登录到该实例时,我可以登录,但当我使用ansible aws.yml文件创建ec2实例并尝试执行相同操作时,我无法连接,并收到一个错误权限被拒绝(publickey)来自每个远程主机,但我运行ansible脚本的主机除外。我的ansible文件中有什么地方做错了吗 这是我的可移植的yml文件 auth: { auth_url: "", # This should be your AWS Ac
权限被拒绝(publickey)
来自每个远程主机,但我运行ansible脚本的主机除外。我的ansible文件中有什么地方做错了吗
这是我的可移植的yml文件
auth: {
auth_url: "",
# This should be your AWS Access Key ID
username: "AKIAJY32VWHYOFOR4J7Q",
# This should be your AWS Secret Access Key
# can be passed as part of cmd line when running the playbook
password: "{{ password | default(lookup('env', 'AWS_SECRET_KEY')) }}"
}
# These variable defines AWS cloud provision attributes
cluster: {
region_name: "us-east-1", #TODO Dynamic fetch
availability_zone: "", #TODO Dynamic fetch based on region
security_group: "Fabric",
target_os: "ubuntu",
image_name: "ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-*",
image_id: "ami-d15a75c7",
flavor_name: "t2.medium", # "m2.medium" is big enough for Fabric
ssh_user: "ubuntu",
validate_certs: True,
private_net_name: "demonet",
public_key_file: "/home/ubuntu/.ssh/fd.pub",
private_key_file: "/home/ubuntu/.ssh/fd",
ssh_key_name: "fabric",
# This variable indicate what IP should be used, only valid values are
# private_ip or public_ip
node_ip: "public_ip",
container_network: {
Network: "172.16.0.0/16",
SubnetLen: 24,
SubnetMin: "172.16.0.0",
SubnetMax: "172.16.255.0",
Backend: {
Type: "udp",
Port: 8285
}
},
service_ip_range: "172.15.0.0/24",
dns_service_ip: "172.15.0.4",
# the section defines preallocated IP addresses for each node, if there is no
# preallocated IPs, leave it blank
node_ips: [ ],
# fabric network node names expect to be using a clear pattern, this defines
# the prefix for the node names.
name_prefix: "fabric",
domain: "fabricnet",
# stack_size determines how many virtual or physical machines we will have
# each machine will be named ${name_prefix}001 to ${name_prefix}${stack_size}
stack_size: 3,
etcdnodes: ["fabric001", "fabric002", "fabric003"],
builders: ["fabric001"],
flannel_repo: "https://github.com/coreos/flannel/releases/download/v0.7.1/flannel-v0.7.1-linux-amd64.tar.gz",
etcd_repo: "https://github.com/coreos/etcd/releases/download/v3.2.0/etcd-v3.2.0-linux-amd64.tar.gz",
k8s_repo: "https://storage.googleapis.com/kubernetes-release/release/v1.7.0/bin/linux/amd64/",
go_ver: "1.8.3",
# If volume want to be used, specify a size in GB, make volume size 0 if wish
# not to use volume from your cloud
volume_size: 8,
# cloud block device name presented on virtual machines.
block_device_name: "/dev/vdb"
}
用于登录:
对于使用ssh登录,我将执行以下步骤
1-下载私钥文件
2-chmod 600私钥
3-ssh-vvv-i~/.ssh/sshkeys.pemubuntu@ec.compute-1.amazonaws.com
我收到错误
权限被拒绝(公钥)
您应该使用为连接到AWS实例而创建的密钥
转到EC2仪表板并查找实例,然后在运行中的实例上单击连接,您需要通过ssh连接到该实例
大概是
ssh-i“XXX.pem”ubuntu@ec2-X-XXX-XX-XX.XX-XXX-2.compute.amazonaws.com
将XXX.pem从安全组保存到您的计算机。
不是您系统的ssh密钥源在Instance处于运行模式后,如何下载密钥对。在创建实例之前,我下载了正确的密钥对,但仍然收到相同的错误。您应该能够从设置中获得它。您是否为此位提供了正确的实例名称:
ubuntu@ec.compute-1.amazonaws.com
?