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

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" 
            } 
        } 
    ] 
} 
主站蜘蛛池模板: 灌云县| 贡嘎县| 元江| 永胜县| 莫力| 汽车| 云林县| 施秉县| 长顺县| 防城港市| 咸丰县| 静安区| 怀安县| 苗栗县| 泾源县| 商水县| 永吉县| 迭部县| 太和县| 渭南市| 鄂州市| 乌兰县| 灌南县| 江陵县| 盐津县| 循化| 安溪县| 夏邑县| 赞皇县| 勃利县| 开封市| 高密市| 海南省| 平武县| 洛阳市| 克东县| 瑞昌市| 霍林郭勒市| 富阳市| 新巴尔虎右旗| 荆门市|