How to get make Cloudformation us a Public AMI

111 views Asked by At

My Task is to automate the creation of an EC2 instance using CloudFormation. I have a script working perfectly with a private AMI. My query is it possible to use an AMI from the marketplace? When I use the AMI ID, when I run the script it says the ID can't be found.

ec22instance:
  Type: 'AWS::EC2::Instance'
  CreationPolicy:
    ResourceSignal:
      Timeout: PT20M
      Count: 1
  Properties:
    DisableApiTermination: false
    EbsOptimized: false
    ImageId: ami-071a99b84dd2f2924
    InstanceInitiatedShutdownBehavior: stop
    InstanceType: m4.2xlarge
    KeyName: !Ref PemKeyName
    Monitoring: true
    SubnetId: !Ref AppAz1SubnetId
    IamInstanceProfile: !Ref InstanceProfile
0

There are 0 answers