remove market place restriction

31 views
Skip to first unread message

Frank Dias

unread,
Dec 17, 2018, 9:54:55 AM12/17/18
to Packer
I have a packer build that uses the AMI source from market place and the parket place image does not support Gen5 instances.
during the build I am adding the required drivers the use Gen5 instance. I have done this manually and now trying to get it into a packer build.

any suggestions as to how to do this with packer.


my manual process;

install ENA drivers
create second volume
dd first volume to second volume
shutdown instance
unmount first volume
mount second volume
start image to confirm working instance
shutdown instance
create ami from instance
launch instance from new ami, no market place instance restrictions

thanks in advance

  

Rickard von Essen

unread,
Dec 22, 2018, 7:21:31 AM12/22/18
to packe...@googlegroups.com
I would start by using the amazon-ebs builder and a provisioner script that installs the ENA driver. That is probably all you have to do. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/32c4b445-95c7-432e-91ff-49a302eb8af9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Frank Dias

unread,
Dec 30, 2018, 11:15:02 PM12/30/18
to Packer
Rickard,

I have tried that and I am still seeing the market restriction on the created AIM.
the only way I have gotten around this has been to create a second volume and dd the original the second the switch volume mounts. after I have done this the market restriction is removed.

I would think that there is a better way to do this with packer.

Frank

Rickard von Essen

unread,
Jan 1, 2019, 8:46:17 AM1/1/19
to packe...@googlegroups.com
Can you link to the market place item?

Frank Dias

unread,
Jan 1, 2019, 9:25:14 PM1/1/19
to Packer
==> amazon-ebs: Prevalidating AMI Name: CentOS Linux 6 x86_64 HVM EBS ENA (encrypted) 20190102
    amazon-ebs: Found Image ID: ami-1585c46a

Frank Dias

unread,
Jan 1, 2019, 9:48:21 PM1/1/19
to Packer
Rickard, 

{
    "description": "Copy the centos.org CentOS 6 AMI into our account so that we can add boot volume encryption.",
    "min_packer_version": "0.11.0",
    "variables": {
        "aws_region": "us-east-1",
        "access_key": "",
        "secret_key": "",
        "ssh_username": "centos"
    },
    "builders": [
        {
            "type": "amazon-ebs",
            "ena_support": true,
            "ami_name": "CentOS Linux 6 x86_64 HVM EBS ENA (encrypted) {{isotime \"20060102\"}}",
            "ami_description": "CentOS Linux 6 x86_64 HVM EBS ENA (encrypted) {{isotime \"20060102\"}}",
            "instance_type": "t2.micro",
            "region": "{{user `aws_region`}}",
            "source_ami_filter": {
                "filters": {
                    "owner-alias": "aws-marketplace",
                    "product-code": "6x5jmcajty9edm3f211pqjfn2",
                    "virtualization-type": "hvm",
                    "state": "available",
                    "root-device-type": "ebs" 
                },
                "owners": [ "679593333241" ],
                "most_recent": true
            },
            "ami_virtualization_type": "hvm",
            "ssh_username": "{{user `ssh_username`}}",
            "associate_public_ip_address": true,
            "tags": {
                "Name": "CentOS 6",
                "OS": "CentOS",
                "OSVER": "6"
            },
            "encrypt_boot": true,
            "communicator": "ssh",
            "ssh_pty": true
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "inline": [
                " echo '** installing base packages....'",
                "sudo yum install -y epel-release",
                "sudo yum install -y cloud-utils-growpart",
                "sudo yum install -y nfs-utils",
                "sudo yum install -y dracut-modules-growroot",
                "sudo yum update -y ",
                "sudo yum clean all"
                ]
                },
                {
            "type": "shell",
            "execute_command": "sudo -S sh '{{.Path}}'",
            "inline_shebang": "/bin/sh -e -x",
            "inline": [
                "echo '** Shreding sensitive data ...'",
                "shred -u /etc/ssh/*_key /etc/ssh/*_key.pub",
                "shred -u /root/.*history /home/{{user `ssh_username`}}/.*history",
                "shred -u /root/.ssh/authorized_keys /home/{{user `ssh_username`}}/.ssh/authorized_keys",
                "sync; sleep 1; sync"
            ]
        }
    ]
Reply all
Reply to author
Forward
0 new messages