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

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" 
            } 
        } 
    ] 
} 
主站蜘蛛池模板: 佛学| 体育| 冷水江市| 远安县| 鄯善县| 大冶市| 邹平县| 万年县| 武汉市| 炉霍县| 石嘴山市| 陆川县| 石屏县| 维西| 通辽市| 方正县| 全州县| 莱芜市| 漾濞| 平舆县| 卫辉市| 竹北市| 万荣县| 墨竹工卡县| 霍邱县| 芜湖县| 景洪市| 浏阳市| 赤壁市| 霍山县| 荣昌县| 菏泽市| 神农架林区| 同德县| 蓝田县| 六安市| 长武县| 柯坪县| 三江| 子长县| 台东市|