สแตก CloudFormation พร้อมการแนบ
ฐาน
เจตนา
บล็อก
ไฟล์
aggregate.yaml— เจตนาของ นัก พัฒนา: ฐาน ข้อมูล payments-dbชนิดcore/datastore/mariadbและreporting-appชนิดexample/compute/db-readerที่ประกาศ ว่า ใช้ ฐาน ข้อมูล ไม่มี สิ่ง ใด เกี่ยว กับ AWS อยู่ ที่ นี่ บล็อก features:ของฐาน ข้อมูล มี storage-headroomซึ่งแนบ example/storage-alarmrelease-one-stack.yaml— ส่วนประกอบ ทั้ง สอง อยู่ ใน แนว เขต เดียว จึง ประกอบ เป็น สแตก เดียว แนบ core/shared-configข้ามแนว เขต release-two-stacks.yaml— เจตนาเดียวกัน แยก เป็น สอง แนว เขต การ อ้างอิง ของ แอปพลิเคชัน ไป ยัง ฐาน ข้อมูล จึง ข้าม เส้น เชื่อม ของ สแตก release-negative-name-collision.yamlกับaggregate-name-collision.yaml— คาดว่า แนบจะ ล้ม เหลว สัญญาณ เตือน สอง ครั้ง กับ ส่วน ประกอบ เดียว manifest.yaml— ผูกชนิด ส่วน ประกอบ แต่ละ ชนิด และ Feature ที่ แนบ แต่ละ รายการ เข้า กับ Recipe ที่ อิมพลีเมนต์ สิ่ง นั้น บน เป้า หมาย นี้ .aggrega-config.yaml— ระบุชื่อ รีจิสทรี hub ที่ เอนทิตี ของ แค็ตตาล็อก หา ค่า มา
Release ทุกroot_password ของpayments-db ด้วย core/generated-secret RDS เป็น
Release ทุกcore/backup กับ payments-db ด้วย infra.retention_days: 14 และ Manifest ผูกcloudformation/backup-native RDS เก็บ"BackupRetentionPeriod": 14 ลงใน Properties ของ
เอนทิตี
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example cloudformation-rds-stackจาก
cd cloudformation-rds-stackบิลด์
ตัวอย่าง
aggrega pull --release release-one-stack.yamlaggrega build --release release-one-stack.yamlบิลด์<workspace> แทน
Total build time: 4.1sBuild completed: 1 file written to <workspace>/distสแตกdist/one-stack/cloudformation/cloudformation-stack.json ส่วน
กับผู้ช่วย AI
ผู้
ใช้เครื่องมือของ Aggrega เท่านั้น และอย่าสร้างโฟลเดอร์เอง หากโฟลเดอร์ Workspace ยังไม่มีโฟลเดอร์ `cloudformation-rds-stack` ให้เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `cloudformation-rds-stack` และไม่ระบุ `dir` เครื่องมือนี้จะเขียนตัวอย่างลงในโฟลเดอร์ `cloudformation-rds-stack` ใหม่ จากนั้นเรียกเครื่องมือ `build` โดยตั้ง `workspace_root` เป็น `cloudformation-rds-stack` ตั้ง `release` เป็น `release-one-stack.yaml` ตั้ง `auto_pull` เป็น true และตั้ง `write` เป็น true บอกฉันว่าการบิลด์เขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใน `cloudformation-rds-stack/dist/`สิ่งที่ได้ในสแตก และใครมีส่วนร่วม
การ
| ทรัพยากร | มี |
|---|---|
PaymentsDb | Recipe ของ |
PaymentsDbStorageHeadroom | การstorage-headroom บน |
AppSharedConfig | การshared-settings บน |
ReportingApp | Recipe ของ |
การbackup บน payments-db ไม่PaymentsDb
ทรัพยากร
"PaymentsDbStorageHeadroom": { "Metadata": { "aggrega.ai/provenance": { "aggrega.ai/aggregate-name": "aggregate", "aggrega.ai/boundary-path": "app", [… omitted: a compiler-version entry, which moves with the build] "aggrega.ai/component-id": "cfr--payments-db--storage-headroom", "aggrega.ai/environment": "production", "aggrega.ai/provider": "cloudformation", [… omitted: a provider-version entry, which moves with the build] "aggrega.ai/recipe-uri": "storage-alarm:1.0.0" } }, [… omitted: the alarm's Properties, printed in full just below] "Type": "AWS::CloudWatch::Alarm" },รายการProperties ของ
สัญญาณstorage-headroom ออกPaymentsDb เหมือน
ชื่อทรัพยากรของการแนบมีขอบเขตที่ถือการแนบนั้นอยู่ด้วย
Feature ถูกpayments-db ที่storage-headroom ได้ PaymentsDbStorageHeadroom
การ
คุณสมบัติ
"Properties": { "AlarmDescription": "Free storage below 21474836480 bytes on payments-db", "ComparisonOperator": "LessThanThreshold", "Dimensions": [ { "Name": "DBInstanceIdentifier", "Value": { "Ref": "PaymentsDb" } } ], "EvaluationPeriods": 2, "MetricName": "FreeStorageSpace", "Namespace": "AWS/RDS", "Period": 300, "Statistic": "Minimum", "Threshold": 21474836480, "TreatMissingData": "breaching" },Ref บนPaymentsDb จาก
ใครตัดสินอะไร ในการแนบหนึ่งรายการ
การaggregate.yaml เพราะ
payments-db: features: storage-headroom: infra: evaluation_periods: 3 notify_target: "arn:aws:sns:eu-west-1:123456789012:payments-oncall"Release ให้ infra สำหรับvalues เลย Release แบบ
"Properties": { "AlarmActions": [ "arn:aws:sns:eu-west-1:123456789012:payments-oncall" ],เมื่อEvaluationPeriods ถอย2 ที่ Recipe มี ไม่ใช่
เอาต์พุตของการแนบตั้งชื่อตามส่วนประกอบที่รับการแนบ ไม่ใช่ตามตัวการแนบเอง
สอง
logical ID ของalarm-id และ
"paymentsXzhdbXXalarmXzhid": { "Value": { "Ref": "PaymentsDbStorageHeadroom" } },สองXzh คือXX คือpayments-db ที่alarm-id และ
นี่alarm-id ดัง
การแนบที่ครอบคลุมทั้งแนวเขตเรนเดอร์หนึ่งครั้งต่อแนวเขต
core/shared-config ถูกAppSharedConfig เพียง
"AppSharedConfig": { [… omitted: the provenance Metadata, whose shape is shown above] "Properties": { "Description": "Settings shared by every component in the app boundary", "Name": "/app/shared-config", "Type": "String", "Value": "tier=production" }, "Type": "AWS::SSM::Parameter" },บิลด์ Release แบบProperties ของ
"Properties": { "Description": "Settings shared by every component in the data boundary", "Name": "/data/shared-config", "Type": "String", "Value": "tier=production-data" }, "Properties": { "Description": "Settings shared by every component in the app boundary", "Name": "/app/shared-config", "Type": "String", "Value": "tier=production-app" },การinfra: และvalues: เลย Aggregate ยัง
แยกเจตนาเดียวกันข้ามสองสแตก
aggrega pull --release release-two-stacks.yamlaggrega build --release release-two-stacks.yamlไม่มีaggregate.yaml เปลี่ยน แอปพลิเคชัน
ใน
"Properties": { "Name": "/reporting/db-host", "Tier": "Standard", "Type": "String", "Value": { "Fn::GetAtt": [ "PaymentsDb", "Endpoint.Address" ] } },ใน
"paymentsXzhdbXXhost": { "Value": { "Fn::GetAtt": [ "PaymentsDb", "Endpoint.Address" ] }, "Export": { "Name": "aggrega--cloudformation-two-stacks--two-stacks-data-zscloudformation--payments-db--host" } },และ
"Properties": { "Name": "/reporting/db-host", "Tier": "Standard", "Type": "String", "Value": {"Fn::ImportValue":"aggrega--cloudformation-two-stacks--two-stacks-data-zscloudformation--payments-db--host"} },มีhost ที่Export เพราะ
ฟังก์ชัน intrinsic ทั้ง
สำหรับFn::ImportValue แทน
บิลด์ที่หยุด
aggrega pull --release release-negative-name-collision.yamlaggrega build --release release-negative-name-collision.yamlaggregate-name-collision.yaml แนบalarm-id เอาต์พุต
[… omitted: the pull's lines, which report the same collision while writing the lockfile][TRANSLATION_ERROR E0038] dispatch groups whose contributors derive one name more than once in one key space caused by (2): [TRANSLATION_ERROR] release-negative-name-collision.yaml derived name collision: one name is derived more than once in one key space ("paymentsXzhdbXXalarmXzhid", key space "output-logical-ids", derived by component "payments-db", carrying attachment "storage-headroom", provider "cloudformation", dispatch path "name-collision/cloudformation") --- [TRANSLATION_ERROR] release-negative-name-collision.yaml derived name collision: one name is derived more than once in one key space ("paymentsXzhdbXXalarmXzhid", key space "output-logical-ids", derived by component "payments-db", carrying attachment "storage-headroom-strict", provider "cloudformation", dispatch path "name-collision/cloudformation")มี
- ทั้ง
สอง แต่ละปลาย ถูก ระบุ ชื่อ รายการ และ ชื่อให้ ส่วน ประกอบ การ แนบ ที่ ส่วน ประกอบ นั้น ถือ อยู่ จึง ค้นหา ทั้ง สอง ได้ ใน ไฟล์ ที่ คุณ เขียน ไม่มี สิ่ง ใด เกี่ยว กับ การ ชน กัน ที่ ทำให้ ชื่อ ของ ผู้ มี ส่วน ร่วม ราย ใด เป็น ชื่อ ที่ ตั้งใจ จึง รายงาน ทั้ง สอง แทน ราย แรก - พื้นที่
คีย์ ถูก ระบุ ชื่อ output-logical-idsบอกว่า ถึง พื้นที่ ชื่อ ใด จาก สอง พื้นที่ ชื่อ ของ สแตก และ เนื่องจาก พื้นที่ ชื่อ ของ ทรัพยากร ไม่ ปรากฏ ใน การ หยุด นี้ จึง บอก ว่า ชื่อ ทรัพยากร ไม่มี ปัญหา - ไม่มี
สิ่ง การใด ถูก ส่ง ออก บิลด์ หยุด แทนที่ จะ เขียน สแตก ที่ สัญญาณ เตือน หนึ่ง ใน สอง ตัว ไม่มี เอาต์พุต อย่าง เงียบๆ - การ
ตั้ง ชื่อชื่อ ทรัพยากร ให้ ต่าง กัน ไม่ แก้ เรื่อง นี้ เอาต์พุต รายการ ที่สร้าง จาก ส่วน ประกอบ ที่ รับ การ แนบ และ รายการ จึง เป็น ต้อง ต่าง กัน ไม่ ว่า จะ เป็นการ แนบ หนึ่ง รายการ แทน สอง รายการ หรือ Feature ที่ ชื่อ รายการ ที่ เผย แพร่ อ่าน เป็น ของ การ แนบ นั้น เอง
อินพุตเดียวกัน เอาต์พุตเดียวกัน
การ
dist/ และ*.lock ถูก