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

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" 
            } 
        } 
    ] 
} 
主站蜘蛛池模板: 全州县| 平安县| 静海县| 铜山县| 叶城县| 安塞县| 淮滨县| 延津县| 阿拉善左旗| 锡林郭勒盟| 柞水县| 辽中县| 扶绥县| 昔阳县| 凤台县| 巴南区| 呼伦贝尔市| 长武县| 闽清县| 临武县| 禄劝| 平潭县| 庆安县| 古丈县| 大埔县| 虞城县| 岑巩县| 科技| 嵊泗县| 洛宁县| 安徽省| 五河县| 东丰县| 克山县| 卢湾区| 尼勒克县| 谢通门县| 临清市| 孙吴县| 都安| 自治县|