Launch AMIs from AWS Marketplace via CloudFormation

1.2k Views Asked by At

does anyone know if it is possible to launch Marketplace AMIs (in this case an OpenVPN Server), via Cloudformation and if so how? I didn't find anything helpful in the AWS Docs / OpenVPN Docs.

1

There are 1 best solutions below

2
On BEST ANSWER

I just do a quick test with this template and CloudFormation runs without error. Note that, my region is Singapore, I think you need to replace the ImageId of your region.

To get the ImageId, you need to launch an EC2 instance with the image in the console. From there you can copy the ImageId.

Those might be helpful: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-ec2.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html

Resources:
  EC2Instance:
    Type: AWS::EC2::Instance
    Properties:
        ImageId: ami-0a8fdce33ca9cbe51 #ap-southeast-1
        KeyName: testkey
        InstanceType: t2.small
        SubnetId: subnet-035***095
        SecurityGroupIds:
        - sg-03f***356
        BlockDeviceMappings:
        -
          DeviceName: /dev/sda1
          Ebs:
            VolumeSize: 8