Cloudformation构建停留在“正在创建”中-尝试添加它以使用特定的SG

时间:2019-04-07 16:09:46

标签: amazon-cloudformation

因此,我添加到此模板的最后一项是尝试使其使用特定的SecurityGroup。我不希望它创建一个新的。当我执行确认检查后返回确定,但显然我的代码仍然不正确。其他的模板工作正常。

我已经尽力了。当我最终超时时,除了“内部错误”之外没有其他错误,所以我在这里茫然。

Parameters:
  VPC:
    Description: Testing using this VPC
    Type: String
    Default: vpc-02765
  SecGroup:
     Description: Name of security group
     Type: AWS::EC2::SecurityGroup
  KeyName:
    Description: Name of an existing EC2 key pair for SSH access to the EC2 instance.
    Type: AWS::EC2::KeyPair::KeyName
  InstanceType:
    Description: EC2 instance type.
    Type: String
    Default: t2.micro
...
...
...
Resources:
  EC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      InstanceType: !Ref 'InstanceType'
      SubnetId: subnet-08b
      KeyName: !Ref 'KeyName'
      SecurityGroupIds:
        - !Ref SecGroup
      ImageId: !FindInMap
        - AWSRegionArch2AMI
        - !Ref 'AWS::Region'
        - HVM64
'''

all I am trying to do is use the items I listed in the template. the vpc,securitygroup. The last time this worked was when I had the code in the template that builds a new SG. I than changed my mind and want to use an existing SG. so somewhere I messed up

1 个答案:

答案 0 :(得分:0)

这适用于我的模板:

Parameters:
  SecGroup:
    Type: AWS::EC2::SecurityGroup::Id
...
Resources:
  MyInstance:
    Properties:
      SecurityGroupIds: 
        - !Ref SecGroup