Hibernate Instance pada pilihan tombol Instance State memiliki fungsi untuk

Questions are collected from Internet and the answers are marked as per my knowledge and understanding (which might differ with yours).
  • AWS services are updated everyday and both the answers and questions might be outdated soon, so research accordingly.
  • AWS exam questions are not updated to keep up the pace with AWS updates, so even if the underlying feature has changed the question might not be updated

    01 Run describe-instances command (OSX/Linux/UNIX) to list the configuration information available for the Amazon EC2 instance that you want to re-create (see the Audit section part II section to identify the right resource):

    aws ec2 describe-instances
      --region us-east-1
      --instance-ids i-01234abcd1234abcd
      --query 'Reservations[*].Instances[]'
    

    02 The command output should return an array with the requested configuration information:

    [
        {
            "AmiLaunchIndex": 0,
            "ImageId": "ami-0abcd1234abcd1234",
            "InstanceId": "i-01234abcd1234abcd",
            "InstanceType": "t2.micro",
            "KeyName": "conformity",
            "LaunchTime": "2021-03-10T10:00:00+00:00",
            "Monitoring": {
                "State": "disabled"
            },
            "Placement": {
                "AvailabilityZone": "us-east-1a",
                "GroupName": "",
                "Tenancy": "default"
            },
            "PrivateDnsName": "ip-10-0-0-15.ec2.internal",
            "PrivateIpAddress": "10.0.0.15",
            "ProductCodes": [],
            "PublicDnsName": "ec2-10-0-1-20.compute-1.amazonaws.com",
            "PublicIpAddress": "10.0.1.20",
            "State": {
                "Code": 16,
                "Name": "running"
            },
            "StateTransitionReason": "",
            "SubnetId": "subnet-abcd1234",
            "VpcId": "vpc-1234abcd",
            "Architecture": "x86_64",
            "BlockDeviceMappings": [
                {
                    "DeviceName": "/dev/xvda",
                    "Ebs": {
                        "AttachTime": "2021-03-10T10:00:00+00:00",
                        "DeleteOnTermination": true,
                        "Status": "attached",
                        "VolumeId": "vol-0abcd1234abcd1234"
                    }
                }
            ],
            "ClientToken": "",
            "EbsOptimized": false,
            "EnaSupport": true,
            "Hypervisor": "xen",
            "IamInstanceProfile": {
                "Arn": "arn:aws:iam::123456789012:instance-profile/ec2-manager-role",
                "Id": "ABCDABCDABCDABCDABCDA"
            },
            "NetworkInterfaces": [
                {
                    "Association": {
                        "IpOwnerId": "amazon",
                        "PublicDnsName": "ec2-10-0-1-20.compute-1.amazonaws.com",
                        "PublicIp": "10.0.1.20"
                    },
                    "Attachment": {
                        "AttachTime": "2021-03-10T10:00:00+00:00",
                        "AttachmentId": "eni-attach-0abcd1234abcd1234",
                        "DeleteOnTermination": true,
                        "DeviceIndex": 0,
                        "Status": "attached",
                        "NetworkCardIndex": 0
                    },
                    "Description": "Primary network interface",
                    "Groups": [
                        {
                            "GroupName": "cc-prod-security-group",
                            "GroupId": "sg-01234abcd1234abcd"
                        }
                    ],
                    "Ipv6Addresses": [],
                    "MacAddress": "0e:53:19:7b:62:6b",
                    "NetworkInterfaceId": "eni-0abcd1234abcd1234",
                    "OwnerId": "123456789012",
                    "PrivateDnsName": "ip-10-0-0-15.ec2.internal",
                    "PrivateIpAddress": "10.0.0.15",
                    "PrivateIpAddresses": [
                        {
                            "Association": {
                                "IpOwnerId": "amazon",
                                "PublicDnsName": "ec2-10-0-1-20.compute-1.amazonaws.com",
                                "PublicIp": "10.0.1.20"
                            },
                            "Primary": true,
                            "PrivateDnsName": "ip-10-0-0-15.ec2.internal",
                            "PrivateIpAddress": "10.0.0.15"
                        }
                    ],
                    "SourceDestCheck": true,
                    "Status": "in-use",
                    "SubnetId": "subnet-abcd1234",
                    "VpcId": "vpc-1234abcd",
                    "InterfaceType": "interface"
                }
            ],
            "RootDeviceName": "/dev/xvda",
            "RootDeviceType": "ebs",
            "SecurityGroups": [
                {
                    "GroupName": "cc-prod-security-group",
                    "GroupId": "sg-01234abcd1234abcd"
                }
            ],
            "SourceDestCheck": true,
            "VirtualizationType": "hvm",
            "CpuOptions": {
                "CoreCount": 2,
                "ThreadsPerCore": 4
            },
            "CapacityReservationSpecification": {
                "CapacityReservationPreference": "open"
            },
            "HibernationOptions": {
                "Configured": false
            },
            "MetadataOptions": {
                "State": "applied",
                "HttpTokens": "optional",
                "HttpPutResponseHopLimit": 1,
                "HttpEndpoint": "enabled"
            },
            "EnclaveOptions": {
                "Enabled": false
            }
        }
    ]
    

    03 Run create-image command (OSX/Linux/UNIX) to create an image from the source Amazon EC2 instance described at the previous step. Include the --no-reboot command parameter to guarantee the file system integrity for your new AMI:

    aws ec2 create-image
      --region us-east-1
      --instance-id i-01234abcd1234abcd
      --name "Project5 EC2 Instance AMI"
      --description "Project5 Production Image"
      --no-reboot
    

    04 The command output should return the ID of the new Amazon Machine Image (AMI):

    {
        "ImageId": "ami-0abcdabcdabcdabcd"
    }
    

    05 Execute run-instances command (OSX/Linux/UNIX) to launch a new Amazon EC2 instance from the AMI created at the previous steps. Use the information returned at step no. 2 for the instance configuration parameters. Set the --hibernation-options parameter to Configured=true to enable the Hibernation feature during the launch process:

    aws ec2 run-instances
      --region us-east-1
      --image-id ami-0abcdabcdabcdabcd
      --count 1
      --instance-type t2.micro
      --key-name conformity
      --security-group-ids sg-01234abcd1234abcd
      --iam-instance-profile Name="ec2-manager-role"
      --hibernation-options Configured=true
    

    06 The command output should return the configuration metadata for the newly created EC2 instance:

    {
        "Groups": [],
        "Instances": [
            {
                "AmiLaunchIndex": 0,
                "ImageId": "ami-0abcdabcdabcdabcd",
                "InstanceId": "i-01234123412341234",
                "InstanceType": "t2.micro",
                "KeyName": "conformity.aws",
                "LaunchTime": "2021-03-22T17:29:43+00:00",
                "Monitoring": {
                    "State": "disabled"
                },
                "Placement": {
                    "AvailabilityZone": "us-east-1e",
                    "GroupName": "",
                    "Tenancy": "default"
                },
                "PrivateDnsName": "ip-10-0-0-5.ec2.internal",
                "PrivateIpAddress": "10.0.0.5",
                "ProductCodes": [],
                "PublicDnsName": "",
                "State": {
                    "Code": 0,
                    "Name": "pending"
                },
                "StateTransitionReason": "",
                "SubnetId": "subnet-abcdabcd",
                "VpcId": "vpc-1234abcd",
                "Architecture": "x86_64",
                "BlockDeviceMappings": [],
                "EbsOptimized": false,
                "EnaSupport": true,
                "Hypervisor": "xen",
                "IamInstanceProfile": {
                    "Arn": "arn:aws:iam::123456789012:instance-profile/ec2-manager-role",
                    "Id": "ABCDABCDABCDABCDABCD"
                },
                "NetworkInterfaces": [
                    {
                        "Attachment": {
                            "AttachTime": "2021-03-22T17:29:43+00:00",
                            "AttachmentId": "eni-attach-0abcd1234abcd1234",
                            "DeleteOnTermination": true,
                            "DeviceIndex": 0,
                            "Status": "attaching",
                            "NetworkCardIndex": 0
                        },
                        "Description": "",
                        "Groups": [
                            {
                                "GroupName": "cc-prod-security-group",
                                "GroupId": "sg-01234abcd1234abcd"
                            }
                        ],
                        "Ipv6Addresses": [],
                        "MacAddress": "06:00:c7:12:51:99",
                        "NetworkInterfaceId": "eni-0abcd1234abcd1234",
                        "OwnerId": "123456789012",
                        "PrivateDnsName": "ip-10-0-0-5.ec2.internal",
                        "PrivateIpAddress": "10.0.0.5",
                        "PrivateIpAddresses": [
                            {
                                "Primary": true,
                                "PrivateDnsName": "ip-10-0-0-5.ec2.internal",
                                "PrivateIpAddress": "10.0.0.5"
                            }
                        ],
                        "SourceDestCheck": true,
                        "Status": "in-use",
                        "SubnetId": "subnet-abcdabcd",
                        "VpcId": "vpc-1234abcd",
                        "InterfaceType": "interface"
                    }
                ],
                "RootDeviceName": "/dev/xvda",
                "RootDeviceType": "ebs",
                "SecurityGroups": [
                    {
                        "GroupName": "cc-prod-security-group",
                        "GroupId": "sg-01234abcd1234abcd"
                    }
                ],
                "SourceDestCheck": true,
                "StateReason": {
                    "Code": "pending",
                    "Message": "pending"
                },
                "VirtualizationType": "hvm",
    		      "HibernationOptions": {
                    "Configured": true
                },
                "CpuOptions": {
                    "CoreCount": 1,
                    "ThreadsPerCore": 1
                },
                "CapacityReservationSpecification": {
                    "CapacityReservationPreference": "open"
                },
                "MetadataOptions": {
                    "State": "pending",
                    "HttpTokens": "optional",
                    "HttpPutResponseHopLimit": 1,
                    "HttpEndpoint": "enabled"
                },
                "EnclaveOptions": {
                    "Enabled": false
                }
            }
        ],
        "OwnerId": "123456789012",
        "ReservationId": "r-0abcd1234abcd1234"
    }
    

    07 To make use of hibernation, run stop-instances command (OSX/Linux/UNIX) using the ID of the newly created instance as the identifier parameter to get the specified Amazon EC2 instance into the hibernation state:

    aws ec2 stop-instances
      --region us-east-1
      --instance-ids i-01234123412341234
      --hibernate
    

    08 The output should return the stop-instances command request metadata:

    {
        "StoppingInstances": [
            {
                "InstanceId": "i-01234123412341234",
                "CurrentState": {
                    "Code": 64,
                    "Name": "stopping"
                },
                "PreviousState": {
                    "Code": 16,
                    "Name": "running"
                }
            }
        ]
    }
    

    09 (Optional) You can terminate the source Amazon EC2 instance in order to stop incurring charges for it. To shut down the instance, run terminate-instances command (OSX/Linux/UNIX) using the source instance ID as the identifier parameter:

    aws ec2 terminate-instances
      --instance-ids i-01234abcd1234abcd
    

    10 The output should return the terminate-instances command request metadata:

    {
        "TerminatingInstances": [
            {
                "InstanceId": "i-01234abcd1234abcd",
                "CurrentState": {
                    "Code": 32,
                    "Name": "shutting-down"
                },
                "PreviousState": {
                    "Code": 16,
                    "Name": "running"
                }
            }
        ]
    }
    

    11 Repeat steps no. 1 – 10 to enable the Hibernation feature for other Amazon EC2 instances provisioned in the selected AWS region.

    12 Change the AWS cloud region by updating the --region command parameter value and repeat the remediation process for other regions.