gpt4 book ai didi

amazon-web-services - 无法通过 CloudFormation 创建 EC2 key 对

转载 作者:行者123 更新时间:2023-12-03 07:30:17 24 4
gpt4 key购买 nike

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-keypair.html

根据本文档,您应该能够在启动实例时创建一个新的 key 对,而不是预先创建一个 key 对并通过参数引用它。

AWS 甚至提供了一个示例:

Resources:
NewKeyPair:
Type: 'AWS::EC2::KeyPair'
Properties:
KeyName: MyKeyPair
Ec2Instance:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: ami-02b92c281a4d3dc79
KeyName: !Ref NewKeyPair

模板有效,但在启动堆栈后出现此错误:

NewKeyPair - 资源处理程序返回消息:“null”(RequestToken:6068026b-63b2-c71b-6cbb-f76f09fe599e,HandlerErrorCode:AlreadyExists)

EC2-SecurityKey - 无法创建以下资源:[NewKeyPair]。用户请求回滚。

有人知道为什么会发生这种回滚以及我是否遗漏了什么?

最佳答案

从 ec2 控制台检查您的 key 对,此错误与您已经创建的名为“MyKeyPair”的 key 有关,这就是出现此错误的原因。如果要创建 key 对,请更改此脚本中的 key 对名称或删除名为“MyKeyPair”的旧 key 对。这可能会解决这个错误

关于amazon-web-services - 无法通过 CloudFormation 创建 EC2 key 对,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72723658/

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