Instance Launch failure through Cloud Formation Template

0

Hello Team, I'm trying to launch an instance through CF template. However, I'm getting below error while launching: "Value of property SubnetId must be of type String" Steps Followed:

  1. Created a VPC CF template and defined "Outputs" in the template section as below:

Outputs:

PublicSubnet1: Description: Public Subnet 1 ID Export: Name: !Sub ${AWS::StackName}-PublicSubnet1 Value: !Ref PublicSubnet1

  1. Created an EC2 launch template and in "Resources" section , defined Subnet properties as follows: Properties: SubnetId: - Fn::ImportValue: !Sub ${ExportVpcStackName}-PublicSubnet1

Can anyone please advise what the reason for failure?

Thanks, Abhishek

posta un anno fa260 visualizzazioni
1 Risposta
0

Here is the example from the documentation:

Resources:
  WebServerInstance:
    Type: 'AWS::EC2::Instance'
    Properties:
      InstanceType: t2.micro
      ImageId: ami-a1b23456
      NetworkInterfaces:
        - GroupSet:
            - Fn::ImportValue: 
              'Fn::Sub': '${NetworkStackNameParameter}-SecurityGroupID'
          AssociatePublicIpAddress: 'true'
          DeviceIndex: '0'
          DeleteOnTermination: 'true'
          SubnetId: Fn::ImportValue 
            'Fn::Sub': '${NetworkStackNameParameter}-SubnetID'

It looks like you are presenting an array, '-', as the value to SubnetId.

profile pictureAWS
ESPERTO
kentrad
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande