Below you will find pages that utilize the taxonomy term “template”
Posts
Deploy s3 bucket by cloudformation
預先準備 需要先把 aws cli 給裝起來
利用CLI可以把預先寫好的基礎建設結構佈署到AWS上,下面是簡單部署一個S3的bucket範例。
aws cloudformation deploy --stack-name paulteststack --template-file ./s3-create-template.json --stack-name: 想要deploy到哪一個cloudformation stack裡 --template-file: template 檔案的所在位置 還有很多參數可以設定,詳情可以參考 create-stack
{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Create S3 bucket on AWS", "Resources": { "S3Test": { "Type": "AWS::S3::Bucket", "Properties": { "BucketName": "paul-test-1495611707" } } } } template 可以依照情境進行更進階的調整,例如調整bucket的CROS讓外部的前端程式可以進行存取。 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Create S3 bucket on AWS", "Resources": { "S3Test": { "Type": "AWS::S3::Bucket", "Properties": { "BucketName": "paul-test-1495611707", "AccessControl": "PublicReadWrite", "CorsConfiguration": { "CorsRules": [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET" ], "AllowedOrigins": [ "*" ], "ExposedHeaders": [ "Date" ], "Id": "myCORSRuleId1", "MaxAge": "3600" }, { "AllowedHeaders": [ "x-amz-*" ], "AllowedMethods": [ "DELETE" ], "AllowedOrigins": [ "http://www.