Skip to content

Instantly share code, notes, and snippets.

@amphied
Last active July 26, 2019 15:52
Show Gist options
  • Select an option

  • Save amphied/040d9601b5aaa67af4d577e17dcf6c2f to your computer and use it in GitHub Desktop.

Select an option

Save amphied/040d9601b5aaa67af4d577e17dcf6c2f to your computer and use it in GitHub Desktop.

Revisions

  1. amphied renamed this gist Feb 26, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. amphied created this gist Feb 26, 2019.
    93 changes: 93 additions & 0 deletions shell-output.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,93 @@
    $ aws --region eu-west-1 ec2 copy-image --description "test-enc" --encrypted --kms-key-id "alias/test-enc" --name "test-enc" --source-image-id ami-0b0aea60d5230c42c --source-region eu-west-1
    --------------------------------------
    | CopyImage |
    +----------+-------------------------+
    | ImageId | ami-0504c6aba12345678 |
    +----------+-------------------------+

    $ aws --region eu-west-1 ec2 modify-image-attribute --image-id ami-0504c6aba12345678 --launch-permission "Add=[{UserId=234567890123}]"

    $ aws --region eu-west-1 ec2 describe-images --image-id ami-0504c6aba12345678
    ---------------------------------------------------------
    | DescribeImages |
    +-------------------------------------------------------+
    || Images ||
    |+----------------------+------------------------------+|
    || Architecture | x86_64 ||
    || CreationDate | 2019-02-26T22:47:49.000Z ||
    || Description | test-enc ||
    || EnaSupport | True ||
    || Hypervisor | xen ||
    || ImageId | ami-0504c6aba12345678 ||
    || ImageLocation | 123456789012/test-enc ||
    || ImageType | machine ||
    || Name | test-enc ||
    || OwnerId | 123456789012 ||
    || Public | False ||
    || RootDeviceName | /dev/sda1 ||
    || RootDeviceType | ebs ||
    || SriovNetSupport | simple ||
    || State | available ||
    || VirtualizationType | hvm ||
    |+----------------------+------------------------------+|
    ||| BlockDeviceMappings |||
    ||+--------------------------+------------------------+||
    ||| DeviceName | /dev/sda1 |||
    ||| VirtualName | |||
    ||+--------------------------+------------------------+||
    |||| Ebs ||||
    |||+----------------------+--------------------------+|||
    |||| DeleteOnTermination | True ||||
    |||| Encrypted | True ||||
    |||| SnapshotId | snap-0b079cc0212345678 ||||
    |||| VolumeSize | 8 ||||
    |||| VolumeType | gp2 ||||
    |||+----------------------+--------------------------+|||
    ||| BlockDeviceMappings |||
    ||+-------------------------+-------------------------+||
    ||| DeviceName | /dev/sdb |||
    ||| VirtualName | ephemeral0 |||
    ||+-------------------------+-------------------------+||
    ||| BlockDeviceMappings |||
    ||+-------------------------+-------------------------+||
    ||| DeviceName | /dev/sdc |||
    ||| VirtualName | ephemeral1 |||
    ||+-------------------------+-------------------------+||

    $ aws --region eu-west-1 ec2 describe-image-attribute --image-id ami-0504c6aba12345678 --attribute launchPermission
    --------------------------------------
    | DescribeImageAttribute |
    +----------+-------------------------+
    | ImageId | ami-0504c6aba12345678 |
    +----------+-------------------------+
    || LaunchPermissions ||
    |+----------------------------------+|
    || UserId ||
    |+----------------------------------+|
    || 234567890123 ||
    |+----------------------------------+|

    $ aws --region eu-west-1 ec2 describe-snapshots --snapshot-ids snap-0b079cc0212345678
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | DescribeSnapshots |
    +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    || Snapshots ||
    |+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+|
    || Description| Copied for DestinationAmi ami-0504c6aba12345678 from SourceAmi ami-0b0aea60d5230c42c for SourceSnapshot snap-029c841b02d957dd6. Task created on 1,551,221,269,368. ||
    || Encrypted | True ||
    || KmsKeyId | arn:aws:kms:eu-west-1:123456789012:key/12345678-1234-1234-1234-123456789012 ||
    || OwnerId | 123456789012 ||
    || Progress | 100% ||
    || SnapshotId | snap-0b079cc0212345678 ||
    || StartTime | 2019-02-26T22:47:56.000Z ||
    || State | completed ||
    || VolumeId | vol-ffffffff ||
    || VolumeSize | 8 ||
    |+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+|

    $ aws --region eu-west-1 ec2 describe-snapshot-attribute --snapshot-id snap-0b079cc0212345678 --attribute createVolumePermission
    ------------------------------------------
    | DescribeSnapshotAttribute |
    +-------------+--------------------------+
    | SnapshotId | snap-0b079cc0212345678 |
    +-------------+--------------------------+