使用 CloudFormation 快速部署 AWS 資源

Chi-Hsuan Huang
2 min readOct 4, 2016

--

CloudFormation /AWS

CloudFormation 是 AWS 提供的一個服務,用來快速建立所需的 AWS 資源。

比方說:當你想要在 EC2 上建立一個 LAMP & MySQL 的時候,你可以不用每次都需要先到 EC2 建立 Instance,然後去透過 RDB 建立 MySQL …等,透過 CloudFormation 建立 JSON-based 的 template 你可以快速建立所需要的資源堆疊(stack)。

CloudFormation 流程 Template — > Stack

在使用 AWS CloudFormation 時,你會需要先建立一個 Template。

建立Template 所需要的參數:

{ "AWSTemplateFormatVersion": “2010–09–09”, 
"Description" : "",
"Parameters": { /* 提供可以選擇的設定 */},
"Resources" : { /* 需要的 AWS 資源 */},
"Outputs" : { /* 完成後的輸出訊息 */}
}

這裡也有官方提供的 LAMP stack basic Tempalte 可以了解。

你可以在 Create Template 製作你的 Template 與驗證是否有效,之後就可以 點選 Create Stack 按照步驟產生你所需要的 AWS Stack!

--

--

Chi-Hsuan Huang

Back to The Mind: Follow Your Heart. Co-Founder at Taiwanstat; Full Stack Developer. https://github.com/chihsuan