Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. shortthirdman renamed this gist Jun 27, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @sebsto sebsto revised this gist Dec 17, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,7 @@ chpasswd:
    list: |
    ec2-user:password

    # On Mac OS, you hdiutil instead of genisoimage
    # On Mac OS, you can use hdiutil instead of genisoimage
    hdiutil makehybrid -o init.iso -hfs -joliet -iso -default-volume-name cidata config

    ## Then attach the init.iso file to the virtual machine before to boot the VDI.
  3. @sebsto sebsto revised this gist Dec 17, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,8 @@ chpasswd:
    list: |
    ec2-user:password

    makehybrid -o init.iso -hfs -joliet -iso -default-volume-name cidata config
    # On Mac OS, you hdiutil instead of genisoimage
    hdiutil makehybrid -o init.iso -hfs -joliet -iso -default-volume-name cidata config

    ## Then attach the init.iso file to the virtual machine before to boot the VDI.
    ## Cloud-init configuration happens ar first boot only, you do not need the ISO file for subsequent boots
  4. @sebsto sebsto created this gist Dec 17, 2017.
    57 changes: 57 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    # Download the VDI from https://cdn.amazonlinux.com/os-images/latest/
    # Doc is at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html
    # Be sure you have config/meta-data and config/user-data ready as per the below
    # change ec2-user's password to your password

    $ cat config/meta-data

    local-hostname: amazonlinux.onprem

    # eth0 is the default network interface enabled in the image. You can configure
    # static network settings with an entry like below.
    #network-interfaces: |
    # iface eth0 inet static
    # address 192.168.1.10
    # network 192.168.1.0
    # netmask 255.255.255.0
    # broadcast 192.168.1.255
    # gateway 192.168.1.254



    $ cat config/user-data
    #cloud-config
    # vim:syntax=yaml
    users:
    # A user by the name ec2-user is created in the image by default.
    - default
    # Following entry create user1 and assigns password specified in plain text.
    # Please not use of plain text password is not recommended from security best
    # practises standpoint
    # - name: user1
    # groups: sudo
    # sudo: ['ALL=(ALL) NOPASSWD:ALL']
    # plain_text_passwd: < plain text password here >
    # lock_passwd: false
    # Following entry creates user2 and attaches a hashed passwd to the user. Hashed
    # passwords can be generated with:
    # python -c 'import crypt,getpass; print crypt.crypt(getpass.getpass())'
    # - name: user2
    # passwd: < hashed password here >
    # lock_passwd: false
    # Following entry creates user3, disables password based login and enables an SSH public key
    # - name: user3
    # ssh-authorized-keys:
    # - < ssh public key here >
    # lock_passwd: true

    chpasswd:
    list: |
    ec2-user:password

    makehybrid -o init.iso -hfs -joliet -iso -default-volume-name cidata config

    ## Then attach the init.iso file to the virtual machine before to boot the VDI.
    ## Cloud-init configuration happens ar first boot only, you do not need the ISO file for subsequent boots
    ## If you need to retry, re-try from the originally downloaded VDI
    ## Keep a copy of the downloaded VDI if you need to make changes to your root disk image.