【发布时间】:2023-03-17 09:22:03
【问题描述】:
最近我开始使用 YAML 学习 Cloud Formation。我的密钥对为 CFNkey、Newkey1、Newkey2。 Here is an image。所以我怀疑我是否尝试将类型作为字符串用于密钥对,我得到this error message。我使用的YAML代码如下:-
AWSTemplateFormatVersion: 2010-09-09
Description: Parameter using the Dynamic KeyName
Parameters:
MyKeyName:
Description: Select the key Name from the below
Type: String
Default: Newkey1
AllowedValues:
- CFNkey
- Newkey2
Resources:
DevEC2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: t2.micro
ImageId: ami-04aa88aebb9fefd83
KeyName: !Ref MyKeyName
SecurityGroup:
- !Ref SSHSecurityGroup
SSHSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: My Sg
SecurityIngress:
IpProtocol: tcp
ToPort: 22
FromPort: 22
Cidr: 0.0.0.0/0
SecurityEgress:
IpProtocol: tcp
ToPort: 8080
FromPort: 8080
Cidr: 0.0.0.0/0
【问题讨论】:
标签: amazon-web-services amazon-ec2 amazon-elastic-beanstalk amazon-cloudformation amazon-ecs