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

Terminating our EC2 instance

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

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

[ec2-user@ip-172-31-22-234 ~]$ sudo stop helloworld
helloworld stop/waiting
[ec2-user@ip-172-31-22-234 ~]$ ec2-metadata --instance-id
instance-id: i-d10e0e62
[ec2-user@ip-172-31-22-234 ~]$ exit
logout
$ aws ec2 terminate-instances --instance-ids i-d10e0e62
{
  "TerminatingInstances": [
    {
      "InstanceId": "i-d10e0e62",
      "CurrentState": {
        "Code": 32,
        "Name": "shutting-down"
      },
      "PreviousState": {
        "Code": 16,
        "Name": "running"
      }
    }
  ]
}  
主站蜘蛛池模板: 江华| 昆明市| 潜江市| 綦江县| 固镇县| 大厂| 中方县| 乌兰浩特市| 鸡东县| 拉萨市| 拜泉县| 铜梁县| 宜川县| 黑山县| 余干县| 珠海市| 上栗县| 浦县| 江华| 永善县| 武鸣县| 隆回县| 永善县| 应城市| 普定县| 获嘉县| 莱西市| 本溪市| 南丹县| 长沙县| 赤城县| 金华市| 灌云县| 精河县| 华蓥市| 抚远县| 酉阳| 大冶市| 女性| 当雄县| 桃园市|