官术网_书友最值得收藏!

Terminating our EC2 instance

As with most Hello World exercises, once the helloworld message is displayed, the goal is reached. It is now time to think about shutting down our server. Since we only pay for what we consume in AWS, freeing up unnecessary resources such as this server is a good strategy for making AWS very cost effective.

We can do a clean shutdown of the Hello World service using the stop command. We can then exit the virtual server and terminate our instance, as follows:

[ec2-user@ip-172-31-22-52 ~]$ sudo stop helloworld 
helloworld stop/waiting 
[ec2-user@ip-172-31-22-52 ~]$ ec2-metadata --instance-id 
instance-id: i-057e8deb1a4c3f35d 
[ec2-user@ip-172-31-22-52 ~]$ exit 
logout 
$ aws ec2 terminate-instances --instance-ids i-057e8deb1a4c3f35d 
{ 
    "TerminatingInstances": [ 
        { 
            "InstanceId": "i-057e8deb1a4c3f35d", 
            "CurrentState": { 
                "Code": 32, 
                "Name": "shutting-down" 
            }, 
            "PreviousState": { 
                "Code": 16, 
                "Name": "running" 
            } 
        } 
    ] 
} 
主站蜘蛛池模板: 宁明县| 清水河县| 修文县| 天门市| 新宁县| 新郑市| 内黄县| 奉节县| 兴宁市| 新乡市| 维西| 拜城县| 吉首市| 全椒县| 榆中县| 小金县| 德清县| 滦南县| 开阳县| 阳泉市| 大方县| 海伦市| 万宁市| 连州市| 永宁县| 奉新县| 扶风县| 南乐县| 雷山县| 通州区| 祥云县| 翁牛特旗| 南城县| 石首市| 镇原县| 抚松县| 霞浦县| 乐陵市| 霍邱县| 郁南县| 鹤庆县|