Resource ALIYUN::ECS::SecurityGroupIngress digunakan untuk membuat aturan grup keamanan masuk.
Sintaksis
{
"Type": "ALIYUN::ECS::SecurityGroupIngress",
"Properties": {
"SourceGroupOwnerId": String,
"Description": String,
"PortRange": String,
"SecurityGroupId": String,
"NicType": String,
"Ipv6SourceCidrIp": String,
"Priority": Integer,
"SourceGroupId": String,
"Policy": String,
"IpProtocol": String,
"SourcePortRange": String,
"SourceCidrIp": String,
"SourcePrefixListId": String
}
}Properti
Nama properti | Type | Required | Dapat diperbarui | Description | Constraints |
IpProtocol | String | Yes | No | Protokol IP. | Nilai yang valid:
|
PortRange | String | Yes | No | Rentang port lapisan transport yang dibuka pada grup keamanan tujuan. | Nilai yang valid:
|
SourcePrefixListId | String | No | No | ID daftar prefiks tujuan yang izin akses masuknya harus dikonfigurasi. | Anda dapat memanggil operasi DescribePrefixLists dari ECS untuk mengkueri ID daftar prefiks yang tersedia. Daftar prefiks tidak didukung untuk security group di jaringan klasik. Jika Anda menentukan SourceCidrIp, Ipv6SourceCidrIp, atau SourceGroupId, parameter ini akan diabaikan. |
SourceGroupId | String | No | No | ID security group sumber. | Anda harus menentukan salah satu antara SourceGroupId atau SourceCidrIp. Jika Anda menentukan SourceGroupId tetapi tidak menentukan SourceCidrIp, NicType diatur ke intranet. Jika Anda menentukan keduanya (SourceGroupId dan SourceCidrIp), pengaturan SourceCidrIp memiliki prioritas lebih tinggi. |
SecurityGroupId | String | No | No | ID grup keamanan tempat Anda ingin membuat aturan masuk. | Tidak ada |
NicType | String | No | No | Jenis jaringan. | Nilai yang valid:
Ketika Anda mengonfigurasi akses timbal balik antar-grup keamanan—misalnya, ketika Anda menentukan DestGroupId tetapi tidak menentukan DestCidrIp—nilai parameter ini adalah intranet. |
Priority | Integer | No | No | Prioritas aturan security group. | Nilainya berkisar antara 1 hingga 100. Nilai default: 1. |
SourceCidrIp | String | No | No | Blok CIDR IPv4 sumber. | Hanya blok CIDR IPv4 yang didukung. |
Policy | String | No | No | Izin akses | Nilai yang valid:
|
SourceGroupOwnerId | String | No | No | ID Akun Alibaba Cloud yang memiliki grup keamanan sumber. Parameter ini digunakan saat Anda mengonfigurasi aturan grup keamanan lintas akun. | Jika SourceGroupOwnerId tidak ditentukan, izin akses secara default diatur untuk grup keamanan lain milik Anda. Jika Anda menentukan SourceCidrIp, parameter ini akan diabaikan. |
Description | String | No | Yes | Deskripsi aturan security group. | Deskripsi harus terdiri dari 1 hingga 512 karakter. |
SourcePortRange | String | No | No | Rentang port lapisan transport yang terbuka pada grup keamanan sumber. | Nilai yang valid:
|
Ipv6SourceCidrIp | String | No | No | Blok CIDR IPv6 sumber. | Mendukung blok CIDR dan alamat IPv6. Hanya alamat IP dalam VPC yang didukung. |
Nilai pengembalian
Fn::GetAtt
Tidak ada.
Contoh
Skenario 1: Pilih grup keamanan yang sudah ada dan buka port masuk 3306.
ROSTemplateFormatVersion: '2015-09-01'
Description: Pilih grup keamanan yang sudah ada dan buka port masuk 3306.
Parameters:
SecurityGroupId:
Type: String
Label: Business Security Group ID
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
Resources:
SecurityGroupIngress_3306:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
SecurityGroupId:
Ref: SecurityGroupId
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 3306/3306
Outputs: {}
Metadata: {}
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Pilih grup keamanan yang sudah ada dan buka port masuk 3306.",
"Parameters": {
"SecurityGroupId": {
"Type": "String",
"Label": "Business Security Group ID",
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId"
}
},
"Resources": {
"SecurityGroupIngress_3306": {
"Type": "ALIYUN::ECS::SecurityGroupIngress",
"Properties": {
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp",
"NicType": "intranet",
"PortRange": "3306/3306"
}
}
},
"Outputs": {
},
"Metadata": {
}
}Skenario 2: Buat grup keamanan dan buka port masuk 80.
ROSTemplateFormatVersion: '2015-09-01'
Description: Buat grup keamanan ECS untuk membuka port masuk 80.
Parameters:
ZoneId:
Type: String
Label: Availability Zone
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/24
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
SecurityGroupIngress_80:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
SecurityGroupId:
Ref: SecurityGroup
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 80/80
Outputs: {}
Metadata: {}
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Buat grup keamanan ECS untuk membuka port masuk 80.",
"Parameters": {
"ZoneId": {
"Type": "String",
"Label": "Availability Zone",
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
}
},
"Resources": {
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": "192.168.0.0/16"
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"ZoneId": {
"Ref": "ZoneId"
},
"VpcId": {
"Ref": "Vpc"
},
"CidrBlock": "192.168.0.0/24"
}
},
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "Vpc"
}
}
},
"SecurityGroupIngress_80": {
"Type": "ALIYUN::ECS::SecurityGroupIngress",
"Properties": {
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp",
"NicType": "intranet",
"PortRange": "80/80"
}
}
},
"Outputs": {
},
"Metadata": {
}
}Skenario 3: Buat Instance ECS dan buka port masuk 3000 sebagai port layanan aplikasi Flowise.
ROSTemplateFormatVersion: '2015-09-01'
Description: Buat Instance ECS Ubuntu 22.04, konfigurasi grup keamanan dan jaringan, otomatiskan instalasi Node.js bersama layanan Agen AI Flowise, serta sediakan URL akses eksternal.
Parameters:
SystemDiskCategory:
Default: cloud_essd
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
AutoChangeType: false
InstanceType: ${InstanceType}
AutoSelectFirst: true
ZoneId: ${ZoneId}
Type: String
Label: System Disk Type
InstanceType:
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
DefaultValueStrategy: recent
ZoneId: ${ZoneId}
Type: String
Label: Instance Type
InstancePassword:
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SelectInstance}
- false
Description: Kata sandi logon untuk server. Password harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
Default: Null
Type: String
Label: Instance Password
NoEcho: true
AssociationProperty: ALIYUN::ECS::Instance::Password
ConstraintDescription: Kata sandi logon untuk server. Password harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
ZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description: <font color='blue'>Templat ini menggunakan Git untuk mengkloning repositori FlowiseAI/Flowise dari GitHub. Anda mungkin mengalami masalah jaringan saat menggunakan templat ini di wilayah dalam Tiongkok. Anda dapat beralih ke wilayah di luar Tiongkok.</font>
Label: Availability Zone
Outputs:
FlowiseUrl:
Description: Alamat default untuk Flowise.
Value:
Fn::Sub:
- http://${IP}:3000
- IP:
Fn::Jq:
- First
- if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress end
- Fn::GetAtt:
- DS_Instances
- Instances
Resources:
SecurityGroupIngress_3000:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
IpProtocol: tcp
SecurityGroupId:
Ref: SecurityGroup
NicType: intranet
SourceCidrIp: 0.0.0.0/0
PortRange: 3000/3000
InstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Ref: Vpc
SecurityGroupId:
Ref: SecurityGroup
ImageId: ubuntu_22_04
IoOptimized: optimized
VSwitchId:
Ref: VSwitch
Password:
Ref: InstancePassword
InstanceName: Flowise
InstanceType:
Ref: InstanceType
MaxAmount: 1
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
DS_Instances:
Type: DATASOURCE::ECS::Instances
Properties:
InstanceIds:
Fn::GetAtt:
- InstanceGroup
- InstanceIds
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
InstallFlowise:
Type: ALIYUN::ECS::RunCommand
Properties:
CommandContent: |
#!/bin/bash
echo "#########################"
echo "# Install NodeJS"
echo "#########################"
git clone https://github.com/nvm-sh/nvm.git /opt/nvm && cd /opt/nvm
ret_code=$?
if [ $ret_code -ne 0 ]; then
echo "Git clone https://github.com/nvm-sh/nvm.git failed. Exiting."
exit $ret_code
fi
./install.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 22
npm config set registry https://registry.npmmirror.com
npm i -g pnpm
echo "#########################"
echo "# Install Flowise"
echo "#########################"
git clone --depth 1 https://github.com/FlowiseAI/Flowise.git /opt/Flowise && cd /opt/Flowise
ret_code=$?
if [ $ret_code -ne 0 ]; then
echo "Git clone https://github.com/FlowiseAI/Flowise.git failed. Exiting."
exit $ret_code
fi
pnpm install
pnpm build
nohup pnpm start > flowise.log 2>&1 &
Type: RunShellScript
Sync: true
InstanceIds:
Fn::GetAtt:
- InstanceGroup
- InstanceIds
Timeout: 1800
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/24
ZoneId:
Ref: ZoneId
Metadata: {}
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Buat Instance ECS Ubuntu 22.04, konfigurasi grup keamanan dan jaringan, otomatiskan instalasi Node.js bersama layanan Agen AI Flowise, serta sediakan URL akses eksternal.",
"Parameters": {
"SystemDiskCategory": {
"Default": "cloud_essd",
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"LocaleKey": "DiskCategory",
"AutoChangeType": false,
"InstanceType": "${InstanceType}",
"AutoSelectFirst": true,
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": "System Disk Type"
},
"InstanceType": {
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"DefaultValueStrategy": "recent",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": "Instance Type"
},
"InstancePassword": {
"AssociationPropertyMetadata": {
"Visible": {
"Condition": {
"Fn::Equals": [
"${SelectInstance}",
false
]
}
}
},
"Description": "Kata sandi logon untuk server. Password harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"Default": null,
"Type": "String",
"Label": "Instance Password",
"NoEcho": true,
"AssociationProperty": "ALIYUN::ECS::Instance::Password",
"ConstraintDescription": "Kata sandi logon untuk server. Password harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"ZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": "<font color='blue'>Templat ini menggunakan Git untuk mengkloning repositori FlowiseAI/Flowise dari GitHub. Anda mungkin mengalami masalah jaringan saat menggunakan templat ini di wilayah dalam Tiongkok. Anda dapat beralih ke wilayah di luar Tiongkok.</font>",
"Label": "Availability Zone"
}
},
"Outputs": {
"FlowiseUrl": {
"Description": "Alamat default untuk Flowise.",
"Value": {
"Fn::Sub": [
"http://${IP}:3000",
{
"IP": {
"Fn::Jq": [
"First",
"if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress end",
{
"Fn::GetAtt": [
"DS_Instances",
"Instances"
]
}
]
}
}
]
}
}
},
"Resources": {
"SecurityGroupIngress_3000": {
"Type": "ALIYUN::ECS::SecurityGroupIngress",
"Properties": {
"IpProtocol": "tcp",
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"NicType": "intranet",
"SourceCidrIp": "0.0.0.0/0",
"PortRange": "3000/3000"
}
},
"InstanceGroup": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"VpcId": {
"Ref": "Vpc"
},
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"ImageId": "ubuntu_22_04",
"IoOptimized": "optimized",
"VSwitchId": {
"Ref": "VSwitch"
},
"Password": {
"Ref": "InstancePassword"
},
"InstanceName": "Flowise",
"InstanceType": {
"Ref": "InstanceType"
},
"MaxAmount": 1
}
},
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "Vpc"
}
}
},
"DS_Instances": {
"Type": "DATASOURCE::ECS::Instances",
"Properties": {
"InstanceIds": {
"Fn::GetAtt": [
"InstanceGroup",
"InstanceIds"
]
}
}
},
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": "192.168.0.0/16"
}
},
"InstallFlowise": {
"Type": "ALIYUN::ECS::RunCommand",
"Properties": {
"CommandContent": "#!/bin/bash\necho \"#########################\"\necho \"# Install NodeJS\"\necho \"#########################\"\ngit clone https://github.com/nvm-sh/nvm.git /opt/nvm && cd /opt/nvm\nret_code=$?\nif [ $ret_code -ne 0 ]; then\n echo \"Git clone https://github.com/nvm-sh/nvm.git failed. Exiting.\"\n exit $ret_code\nfi\n./install.sh\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\"\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\"\nnvm install 22\nnpm config set registry https://registry.npmmirror.com\nnpm i -g pnpm\n\necho \"#########################\"\necho \"# Install Flowise\"\necho \"#########################\"\ngit clone --depth 1 https://github.com/FlowiseAI/Flowise.git /opt/Flowise && cd /opt/Flowise\nret_code=$?\nif [ $ret_code -ne 0 ]; then\n echo \"Git clone https://github.com/FlowiseAI/Flowise.git failed. Exiting.\"\n exit $ret_code\nfi\npnpm install\npnpm build\nnohup pnpm start > flowise.log 2>&1 &\n",
"Type": "RunShellScript",
"Sync": true,
"InstanceIds": {
"Fn::GetAtt": [
"InstanceGroup",
"InstanceIds"
]
},
"Timeout": 1800
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"CidrBlock": "192.168.0.0/24",
"ZoneId": {
"Ref": "ZoneId"
}
}
}
},
"Metadata": {
}
}Untuk informasi selengkapnya, lihat templat publik yang berisi resource ini.