From 627bdbc7eacd7dfe143db94b499bb111563a4ea8 Mon Sep 17 00:00:00 2001 From: baichenxu3 Date: Thu, 19 Oct 2023 16:36:35 +0800 Subject: [PATCH] Optimization Wordpress_Instance template. --- examples/elastic/wordpress-instance.yml | 275 ++++-------------------- 1 file changed, 45 insertions(+), 230 deletions(-) diff --git a/examples/elastic/wordpress-instance.yml b/examples/elastic/wordpress-instance.yml index 0d790614..edd16454 100644 --- a/examples/elastic/wordpress-instance.yml +++ b/examples/elastic/wordpress-instance.yml @@ -3,15 +3,6 @@ Description: en: Create a wordpress instance. zh-cn: 创建一台ECS实例并部署WordPress。 Parameters: - SelectExistECS: - Type: Boolean - Label: - en: Whether to select an existing instance - zh-cn: 是否选择已有实例 - Description: - en: Whether to select an existing Centos7 system instance. The Centos7 system instance must be connected to a public network. - zh-cn: 是否选择已有Centos7系统实例,实例需要开通公网。 - Default: false VpcCidrBlock: Type: String Label: @@ -25,9 +16,9 @@ Parameters: color='green'>[172.16.0.0/12]
[192.168.0.0/16] Default: 192.168.0.0/16 AllowedValues: - - 192.168.0.0/16 - - 172.16.0.0/12 - - 10.0.0.0/8 + - 192.168.0.0/16 + - 172.16.0.0/12 + - 10.0.0.0/8 ZoneId: Type: String Label: @@ -37,22 +28,6 @@ Parameters: en: Availability Zone ID,
note: Before selecting, please confirm that the Availability Zone supports the specification of creating RDS and ECS resources. zh-cn: 可用区ID。
注: 选择可用区前请确认该可用区是否支持创建RDS及ECS资源的规格。 AssociationProperty: ALIYUN::ECS::Instance:ZoneId - ECSInstanceId: - Type: String - Label: - en: Existing ECS Instance - zh-cn: 已创建ECS实例 - Description: - en: Select an ECS instance with the CentOS 7.9 64-bit operating system. - zh-cn: 选择已存在操作系统为CentOS 7.9 64位的ECS实例。 - AssociationProperty: ALIYUN::ECS::Instance::InstanceId - AssociationPropertyMetadata: - Visible: - Condition: - Fn::Equals: - - ${SelectExistECS} - - true - Default: '' VSwitchCidrBlock: Type: String Label: @@ -78,12 +53,6 @@ Parameters: AssociationProperty: ALIYUN::ECS::Instance::InstanceType AssociationPropertyMetadata: ZoneId: ZoneId - Visible: - Condition: - Fn::Equals: - - ${SelectExistECS} - - false - Default: ecs.c5.large SystemDiskCategory: Type: String Label: @@ -97,12 +66,6 @@ Parameters: LocaleKey: DiskCategory InstanceType: ${InstanceType} ZoneId: ZoneId - Visible: - Condition: - Fn::Equals: - - ${SelectExistECS} - - false - Default: cloud_efficiency InstancePassword: Type: String Label: @@ -118,12 +81,6 @@ Parameters: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in). zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。 AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$' - AssociationPropertyMetadata: - Visible: - Condition: - Fn::Equals: - - ${SelectExistECS} - - false MinLength: 8 MaxLength: 30 NoEcho: true @@ -208,15 +165,6 @@ Parameters: MinLength: 8 MaxLength: 32 NoEcho: true -Conditions: - IsSelectExistECS: - Fn::Equals: - - Ref: SelectExistECS - - false - NotSelectExistECS: - Fn::Equals: - - Ref: SelectExistECS - - true Resources: Vpc: Type: ALIYUN::ECS::VPC @@ -224,9 +172,6 @@ Resources: CidrBlock: Ref: VpcCidrBlock VpcName: wordpress_vpc - Metadata: - ALIYUN::ROS::Designer: - id: a42f5f2f-e0b5-4e9c-8aef-dea7ef1c3785 VSwitch: Type: ALIYUN::ECS::VSwitch Properties: @@ -234,13 +179,10 @@ Resources: Ref: ZoneId VpcId: Fn::GetAtt: - - Vpc - - VpcId + - Vpc + - VpcId CidrBlock: Ref: VSwitchCidrBlock - Metadata: - ALIYUN::ROS::Designer: - id: f2c86dc8-0554-4d0e-9923-100ad315b695 Database: Type: ALIYUN::RDS::DBInstance Properties: @@ -256,9 +198,9 @@ Resources: DBInstanceStorage: Ref: DBInstanceStorage DBMappings: - - CharacterSetName: utf8 - DBName: - Ref: DBName + - CharacterSetName: utf8 + DBName: + Ref: DBName Engine: MySQL EngineVersion: Ref: EngineVersion @@ -268,15 +210,9 @@ Resources: Ref: DBUser SecurityIPList: 0.0.0.0/0 AllocatePublicConnection: true - Metadata: - ALIYUN::ROS::Designer: - id: 12a1247f-2409-472a-b877-9c7d51f7b4df WebServerConditionHandle: Type: ALIYUN::ROS::WaitConditionHandle - Properties: {} - Metadata: - ALIYUN::ROS::Designer: - id: 4af2a0d0-f515-4cb8-8a2d-1a6443bc41fc + Properties: { } RosWaitCondition: Type: ALIYUN::ROS::WaitCondition Properties: @@ -284,12 +220,8 @@ Resources: Handle: Ref: WebServerConditionHandle Timeout: 3600 - Metadata: - ALIYUN::ROS::Designer: - id: fb8cfc4c-e5b0-408e-8f86-e3df7fb05f50 SecurityGroup: Type: ALIYUN::ECS::SecurityGroup - Condition: IsSelectExistECS Properties: VpcId: Ref: Vpc @@ -299,25 +231,14 @@ Resources: id: 4740a2b8-d119-4bc8-956d-6b02e2d7aa9f SecurityGroupIngress: Type: ALIYUN::ECS::SecurityGroupIngress - Condition: IsSelectExistECS Properties: SecurityGroupId: Ref: SecurityGroup IpProtocol: all PortRange: -1/-1 SourceCidrIp: 0.0.0.0/0 - Metadata: - ALIYUN::ROS::Designer: - id: 47bec69f-674c-4bed-a162-6b8f94ceed7d - ExistWebServer: - Type: DATASOURCE::ECS::Instances - Condition: NotSelectExistECS - Properties: - InstanceId: - Ref: ECSInstanceId WebServer: Type: ALIYUN::ECS::Instance - Condition: IsSelectExistECS Properties: VpcId: Ref: Vpc @@ -333,10 +254,9 @@ Resources: IoOptimized: optimized Password: Ref: InstancePassword + SystemDiskCategory: + Ref: SystemDiskCategory DependsOn: Database - Metadata: - ALIYUN::ROS::Designer: - id: 8d121091-2248-4d9c-9244-66efdf28856b Command: Type: ALIYUN::ECS::Command Properties: @@ -404,12 +324,9 @@ Resources: Type: ALIYUN::ECS::Invocation Properties: InstanceIds: - - Fn::If: - - IsSelectExistECS - - Fn::GetAtt: - - WebServer - - InstanceId - - Ref: ECSInstanceId + - Fn::GetAtt: + - WebServer + - InstanceId CommandId: Ref: Command Outputs: @@ -417,154 +334,52 @@ Outputs: Description: The instance id of created database instance. Value: Fn::GetAtt: - - Database - - DBInstanceId + - Database + - DBInstanceId InnerConnectionString: Description: DB instance connection url by Intranet. Value: Fn::GetAtt: - - Database - - InnerConnectionString + - Database + - InnerConnectionString InstanceId: - Condition: IsSelectExistECS Description: The instance id of WebServer instance. Value: Fn::GetAtt: - - WebServer - - InstanceId + - WebServer + - InstanceId WordPressUrl: Description: Wordpress default address. Value: Fn::Sub: - 'http://${IP}' - IP: - 'Fn::If': - - IsSelectExistECS - - 'Fn::GetAtt': - - WebServer - - PublicIp - - 'Fn::Jq': - - First - - >- - if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] - else .[0].EipAddress.IpAddress end - - 'Fn::GetAtt': - - ExistWebServer - - Instances + Fn::GetAtt: + - WebServer + - PublicIp Metadata: ALIYUN::ROS::Interface: ParameterGroups: - - Parameters: - - VpcCidrBlock - - ZoneId - - VSwitchCidrBlock - Label: - default: VPC - - Parameters: - - SelectExistECS - - ECSInstanceId - - InstanceType - - SystemDiskCategory - - InstancePassword - Label: - default: ECS - - Parameters: - - EngineVersion - - DBInstanceClass - - DBInstanceStorage - - DBName - - DBUser - - DBPassword - Label: - default: RDS + - Parameters: + - VpcCidrBlock + - ZoneId + - VSwitchCidrBlock + Label: + default: VPC + - Parameters: + - InstanceType + - SystemDiskCategory + - InstancePassword + Label: + default: ECS + - Parameters: + - EngineVersion + - DBInstanceClass + - DBInstanceStorage + - DBName + - DBUser + - DBPassword + Label: + default: RDS TemplateTags: - - acs:example:网站:基于ECS和RDS创建WordPress环境 - ALIYUN::ROS::Designer: - 12a1247f-2409-472a-b877-9c7d51f7b4df: - position: - x: 250 - y: 130 - size: - height: 60 - width: 60 - z: 2 - 4740a2b8-d119-4bc8-956d-6b02e2d7aa9f: - position: - x: 350 - y: 263 - size: - height: 60 - width: 60 - z: 1 - 47bec69f-674c-4bed-a162-6b8f94ceed7d: - position: - x: 569 - y: 263 - size: - height: 60 - width: 60 - z: 0 - 4af2a0d0-f515-4cb8-8a2d-1a6443bc41fc: - position: - x: 566 - y: 186 - size: - height: 60 - width: 60 - z: 0 - 78bb2b9f-0209-45c8-83b3-514a01eefb95: - source: - id: 47bec69f-674c-4bed-a162-6b8f94ceed7d - target: - id: 4740a2b8-d119-4bc8-956d-6b02e2d7aa9f - z: 1 - 7ec2764e-c05a-406e-b0c9-24622e15e941: - source: - id: fb8cfc4c-e5b0-408e-8f86-e3df7fb05f50 - target: - id: 4af2a0d0-f515-4cb8-8a2d-1a6443bc41fc - z: 1 - 8d121091-2248-4d9c-9244-66efdf28856b: - position: - x: 350 - y: 130 - size: - height: 60 - width: 60 - z: 2 - 91d3be94-a57a-4bd4-8470-3af22dc633be: - source: - id: 8d121091-2248-4d9c-9244-66efdf28856b - target: - id: 4740a2b8-d119-4bc8-956d-6b02e2d7aa9f - z: 1 - a42f5f2f-e0b5-4e9c-8aef-dea7ef1c3785: - embeds: - - f2c86dc8-0554-4d0e-9923-100ad315b695 - - 4740a2b8-d119-4bc8-956d-6b02e2d7aa9f - position: - x: 194 - y: 55 - size: - height: 311 - width: 316 - z: 0 - f2c86dc8-0554-4d0e-9923-100ad315b695: - embeds: - - 12a1247f-2409-472a-b877-9c7d51f7b4df - - 8d121091-2248-4d9c-9244-66efdf28856b - position: - x: 211 - y: 90 - size: - height: 151 - width: 222 - z: 1 - fb8cfc4c-e5b0-408e-8f86-e3df7fb05f50: - position: - x: 566 - y: 83 - size: - height: 60 - width: 60 - z: 0 + - acs:example:网站:基于ECS和RDS创建WordPress环境