ALIYUN::ECS::SecurityGroup リソースは、セキュリティグループの作成に使用されます。
構文
{
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": String,
"Description": String,
"SecurityGroupName": String,
"Tags": List,
"SecurityGroupEgress": List,
"SecurityGroupIngress": List,
"ResourceGroupId": String,
"SecurityGroupType": String
}
}プロパティ
プロパティ名 | 型 | 必須 | 更新可能 | 説明 | 制約 |
ResourceGroupId | String | いいえ | はい | セキュリティグループが属するリソースグループの ID です。 | なし |
VpcId | String | いいえ | いいえ | VPC の ID です。 | なし |
Description | String | いいえ | いいえ | セキュリティグループの説明です。 | 長さは 2~256 文字です。 |
Tags | List | いいえ | はい | セキュリティグループのタグです。 | 最大 20 個のタグをサポートします。 詳細については、「Tags のプロパティ」をご参照ください。 |
SecurityGroupName | String | いいえ | いいえ | セキュリティグループの名前です。 | 指定しない場合、値は空になります。デフォルト値は空です。
|
SecurityGroupEgress | List | いいえ | はい | セキュリティグループの送信ルールです。 | 詳細については、「SecurityGroupEgress のプロパティ」をご参照ください。 |
SecurityGroupIngress | List | いいえ | はい | セキュリティグループの受信ルールです。 | 詳細については、「SecurityGroupIngress のプロパティ」をご参照ください。 |
SecurityGroupType | String | いいえ | いいえ | セキュリティグループのタイプです。 | 有効値:
|
Tags の構文
"Tags": [
{
"Value" : String,
"Key" : String
}
]Tags のプロパティ
プロパティ名 | 型 | 必須 | 更新可能 | 説明 | 制約 |
Key | String | はい | いいえ | タグキーです。 | 長さは 1~128 文字です。 |
Value | String | いいえ | いいえ | タグ値です。 | 長さは 0~128 文字です。 |
SecurityGroupEgress の構文
"SecurityGroupEgress": [
{
"Description": String,
"PortRange": String,
"NicType": String,
"Priority": Integer,
"DestGroupId": String,
"DestCidrIp": String,
"Policy": String,
"IpProtocol": String,
"DestGroupOwnerId": String,
"Ipv6DestCidrIp": String,
"DestPrefixListId": String,
"SourcePortRange": String,
"Ipv6SourceCidrIp": String,
"SourceCidrIp": String,
"DestGroupOwnerAccount": String
}
]SecurityGroupEgress のプロパティ
プロパティ名 | 型 | 必須 | 更新可能 | 説明 | 制約 |
Description | String | いいえ | はい | セキュリティグループルールの説明です。 | 長さは 1~512 文字です。 |
DestGroupOwnerId | String | いいえ | いいえ | アカウント間でセキュリティグループルールを設定する際の、宛先セキュリティグループの Alibaba Cloud アカウント ID です。 | `DestGroupOwnerId` を設定しない場合、他のセキュリティグループへのアクセス権限を設定するものとみなされます。`DestCidrIp` パラメーターを設定した場合、`DestGroupOwnerId` パラメーターは無効になります。 |
IpProtocol | String | はい | いいえ | IP プロトコルです。 | 有効値:
|
PortRange | String | はい | いいえ | IP プロトコルに関連するポート範囲です。 | 宛先セキュリティグループが開くトランスポート層プロトコルに関連するポート範囲です。有効値:
|
NicType | String | いいえ | いいえ | ネットワークタイプです。 | 有効値:
VPC セキュリティグループルールの場合、NIC タイプを設定する必要はありません。デフォルト値は `intranet` であり、`intranet` のみ指定可能です。 セキュリティグループ間の相互アクセスを設定する場合、つまり `DestGroupId` パラメーターのみを指定する場合、値は `intranet` のみ指定可能です。 デフォルト値:internet。 |
DestPrefixListId | String | いいえ | いいえ | 送信アクセス権限を設定する宛先プレフィックスリストの ID です。 | Alibaba Cloud サービス ECS の `DescribePrefixLists` インターフェイスを呼び出して、利用可能なプレフィックスリスト ID をクエリします。 セキュリティグループのネットワークタイプがクラシックネットワークの場合、プレフィックスリストはサポートされません。 `DestCidrIp`、`Ipv6DestCidrIp`、または `DestGroupId` パラメーターのいずれかを指定した場合、このパラメーターは無視されます。 |
Priority | Integer | いいえ | いいえ | 権限付与ポリシーの優先度です。 | 有効値:1~100。 デフォルト値:1。 |
DestGroupId | String | いいえ | いいえ | 同じリージョン内の宛先セキュリティグループの ID です。 | `DestGroupId` または `DestCidrIp` パラメーターのいずれかを指定します。
|
DestCidrIp | String | いいえ | いいえ | 宛先 IP アドレス範囲です。 | IP アドレス範囲を CIDR 形式で指定します。 デフォルト値:0.0.0.0/0 (制限なし)。 その他のサポートされる形式 (例:10.159.XX.XX/12)。 最大 10 個の IP アドレスまたは CIDR ブロックをカンマ (,) で区切ります。 説明 IPv4 のみがサポートされています。 |
Policy | String | いいえ | いいえ | 権限付与ポリシーです。 | 有効値:
|
Ipv6DestCidrIp | String | いいえ | いいえ | 宛先 IPv6 CIDR ブロックです。 | CIDR および IPv6 形式の IP アドレス範囲をサポートします。VPC タイプの IP アドレスのみをサポートします。 |
SourcePortRange | String | いいえ | いいえ | セキュリティグループが開くトランスポート層プロトコルに関連するソースポート範囲です。 | 有効値:
5タプルルールについては、「セキュリティグループの5タプルルール」をご参照ください。 |
Ipv6SourceCidrIp | String | いいえ | いいえ | ソース IPv6 CIDR ブロックです。 | CIDR および IPv6 形式の IP アドレス範囲をサポートします。 5タプルルールについては、「セキュリティグループの5タプルルール」をご参照ください。 説明 このパラメーターは、IPv6 が有効な VPC 内の ECS インスタンスでのみ有効です。このパラメーターと |
SourceCidrIp | String | いいえ | いいえ | ソース IPv4 CIDR ブロックです。 | CIDR および IPv4 形式の IP アドレス範囲をサポートします。 5タプルルールについては、「セキュリティグループの5タプルルール」をご参照ください。 |
DestGroupOwnerAccount | String | いいえ | いいえ | 宛先セキュリティグループが属する Alibaba Cloud アカウントです。 |
|
SecurityGroupIngress の構文
"SecurityGroupIngress": [
{
"SourceGroupOwnerId": String,
"Description": String,
"PortRange": String,
"NicType": String,
"Ipv6SourceCidrIp": String,
"Priority": Integer,
"SourceGroupId": String,
"Policy": String,
"IpProtocol": String,
"SourcePortRange": String,
"SourceCidrIp": String,
"SourcePrefixListId": String,
"Ipv6DestCidrIp": String,
"SourceGroupOwnerAccount": String,
"DestCidrIp": String
}
]SecurityGroupIngress のプロパティ
プロパティ名 | 型 | 必須 | 更新可能 | 説明 | 制約 |
SourceGroupOwnerId | String | いいえ | いいえ | ソースセキュリティグループの Alibaba Cloud アカウント ID です。 | なし |
Description | String | いいえ | はい | セキュリティグループルールの説明です。 | 長さは 1~512 文字です。 |
SourcePrefixListId | String | いいえ | いいえ | 受信アクセス権限を設定するソースプレフィックスリストの ID です。 | Alibaba Cloud サービス ECS の `DescribePrefixLists` インターフェイスを呼び出して、利用可能なプレフィックスリスト ID をクエリします。 セキュリティグループのネットワークタイプがクラシックネットワークの場合、プレフィックスリストはサポートされません。 `SourceCidrIp`、`Ipv6DestCidrIp`、または `DestGroupId` パラメーターのいずれかを指定した場合、システムはこのパラメーターを無視します。 |
IpProtocol | String | はい | いいえ | IP プロトコルです。 | 有効値:
|
PortRange | String | はい | いいえ | IP プロトコルに関連するポート範囲です。 | 宛先セキュリティグループが開くトランスポート層プロトコルに関連するポート範囲です。有効値:
|
SourceGroupId | String | いいえ | いいえ | 同じリージョン内のソースセキュリティグループの ID です。 | `SourceGroupId` または `SourceCidrIp` パラメーターのいずれかを指定します。 両方を指定した場合、デフォルトで `SourceCidrIp` が承認されます。 このパラメーターを指定し、`SourceCidrIp` を指定しない場合、`NicType` は `intranet` のみ指定可能です。 |
NicType | String | いいえ | いいえ | ネットワークタイプです。 | 有効値:
|
Priority | Integer | いいえ | いいえ | 権限付与ポリシーの優先度です。 | 有効値:1~100。 デフォルト値:1。 |
SourceCidrIp | String | いいえ | いいえ | ソース IP アドレス範囲です。 | IP アドレス範囲を CIDR 形式で指定します。 デフォルト値:0.0.0.0/0 (制限なし)。 その他のサポートされる形式 (例:10.159.XX.XX/12)。 最大 10 個の IP アドレスまたは CIDR ブロックをカンマ (,) で区切ります。 説明 IPv4 のみがサポートされています。 |
Policy | String | いいえ | いいえ | 権限付与ポリシーです。 | 有効値:
|
SourcePortRange | String | いいえ | いいえ | ソースセキュリティグループで開かれているトランスポート層プロトコルのポート範囲です。 | 有効値:
|
Ipv6SourceCidrIp | String | いいえ | いいえ | ソース IPv6 CIDR ブロックです。 | VPC タイプの IP アドレスのみをサポートします。CIDR および IPv6 形式の IP アドレス範囲をサポートします。 |
Ipv6DestCidrIp | String | いいえ | いいえ | 宛先 IPv6 CIDR ブロックです。 | CIDR および IPv6 形式の IP アドレス範囲をサポートします。 説明 このパラメーターは、IPv6 が有効な VPC 内の ECS インスタンスでのみ有効です。このパラメーターと |
SourceGroupOwnerAccount | String | いいえ | いいえ | ソースセキュリティグループが属する Alibaba Cloud アカウントです。 |
|
DestCidrIp | String | いいえ | いいえ | 宛先 IPv4 CIDR ブロックです。 | CIDR および IPv4 形式の IP アドレス範囲をサポートします。 5タプルルールについては、「セキュリティグループの5タプルルール」をご参照ください。 |
戻り値
Fn::GetAtt
SecurityGroupId:セキュリティグループの ID。
SecurityGroupName:セキュリティグループの名前。
例
シナリオ 1:既存の VPC に基本セキュリティグループを作成する。
ROSTemplateFormatVersion: '2015-09-01'
Resources:
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
SecurityGroupIngress:
- PortRange: 22/22
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
SecurityGroupType: normal
VpcId:
Ref: VpcId
SecurityGroupEgress:
- PortRange: 443/443
DestCidrIp: 0.0.0.0/0
IpProtocol: tcp
SecurityGroupName: TestSecurityGroupName
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Label:
zh-cn: 现有 VPC 实例 ID
en: 既存の VPC インスタンス ID
Outputs:
SecurityGroupId:
Description: generated security group id for security group.
Value:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupId
SecurityGroupName:
Description: The name of security group.
Value:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupName
{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"SecurityGroupIngress": [
{
"PortRange": "22/22",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
},
{
"PortRange": "80/80",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
}
],
"SecurityGroupType": "normal",
"VpcId": {
"Ref": "VpcId"
},
"SecurityGroupEgress": [
{
"PortRange": "443/443",
"DestCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
}
],
"SecurityGroupName": "TestSecurityGroupName"
}
}
},
"Parameters": {
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Label": {
"zh-cn": "现有 VPC 实例 ID",
"en": "既存の VPC インスタンス ID"
}
}
},
"Outputs": {
"SecurityGroupId": {
"Description": "generated security group id for security group.",
"Value": {
"Fn::GetAtt": [
"SecurityGroup",
"SecurityGroupId"
]
}
},
"SecurityGroupName": {
"Description": "The name of security group.",
"Value": {
"Fn::GetAtt": [
"SecurityGroup",
"SecurityGroupName"
]
}
}
}
}
シナリオ 2:既存の VPC に高度セキュリティグループを作成する。
ROSTemplateFormatVersion: '2015-09-01'
Resources:
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
SecurityGroupIngress:
- PortRange: 22/22
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
SecurityGroupType: enterprise
VpcId:
Ref: VpcId
SecurityGroupEgress:
- PortRange: 443/443
DestCidrIp: 0.0.0.0/0
IpProtocol: tcp
SecurityGroupName: TestSecurityGroupName
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Label:
zh-cn: 现有 VPC 实例 ID
en: 既存の VPC インスタンス ID
Outputs:
SecurityGroupId:
Description: generated security group id for security group.
Value:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupId
SecurityGroupName:
Description: The name of security group.
Value:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupName
{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"SecurityGroupIngress": [
{
"PortRange": "22/22",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
},
{
"PortRange": "80/80",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
}
],
"SecurityGroupType": "enterprise",
"VpcId": {
"Ref": "VpcId"
},
"SecurityGroupEgress": [
{
"PortRange": "443/443",
"DestCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
}
],
"SecurityGroupName": "TestSecurityGroupName"
}
}
},
"Parameters": {
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Label": {
"zh-cn": "现有 VPC 实例 ID",
"en": "既存の VPC インスタンス ID"
}
}
},
"Outputs": {
"SecurityGroupId": {
"Description": "generated security group id for security group.",
"Value": {
"Fn::GetAtt": [
"SecurityGroup",
"SecurityGroupId"
]
}
},
"SecurityGroupName": {
"Description": "The name of security group.",
"Value": {
"Fn::GetAtt": [
"SecurityGroup",
"SecurityGroupName"
]
}
}
}
}シナリオ 3: ECS インスタンスを作成し、セキュリティグループを設定して受信ポート 9966 を開く。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: ECS インスタンスを作成し、セキュリティグループを設定して受信ポート 9966 を開く。
en: ECS インスタンスを作成し、セキュリティグループを設定して受信ポート 9966 を開く。
Parameters:
ZoneId:
Type: String
Label:
en: アベイラビリティゾーン
zh-cn: ゾーン ID
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
InstanceType:
Type: String
Label:
en: インスタンスタイプ
zh-cn: インスタンスタイプ
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
SystemDiskCategory:
Type: String
Label:
en: システムディスクタイプ
zh-cn: システムディスクタイプ
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
ZoneId: ${ZoneId}
InstanceType: ${InstanceType}
AutoSelectFirst: true
AutoChangeType: false
Default: cloud_essd
InstancePassword:
Type: String
NoEcho: true
Label:
en: インスタンスパスワード
zh-cn: インスタンスパスワード
Description:
en: サーバーのログインパスワード。長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。
zh-cn: サーバーのログインパスワード。長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。
ConstraintDescription:
en: 長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。
zh-cn: 長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${SelectInstance}
- false
Default: Null
AssociationProperty: ALIYUN::ECS::Instance::Password
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_9966:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
SecurityGroupId:
Ref: SecurityGroup
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 9966/9966
InstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId: ubuntu_22_04
InstanceName: ChatTTS
InstanceType:
Ref: InstanceType
SystemDiskCategory:
Ref: SystemDiskCategory
Password:
Ref: InstancePassword
IoOptimized: optimized
MaxAmount: 1
Outputs: {}
Metadata: {}
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "ECS インスタンスを作成し、セキュリティグループを設定して受信ポート 9966 を開く。",
"en": "ECS インスタンスを作成し、セキュリティグループを設定して受信ポート 9966 を開く。"
},
"Parameters": {
"ZoneId": {
"Type": "String",
"Label": {
"en": "アベイラビリティゾーン",
"zh-cn": "ゾーン ID"
},
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
},
"InstanceType": {
"Type": "String",
"Label": {
"en": "インスタンスタイプ",
"zh-cn": "インスタンスタイプ"
},
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "${ZoneId}"
}
},
"SystemDiskCategory": {
"Type": "String",
"Label": {
"en": "システムディスクタイプ",
"zh-cn": "システムディスクタイプ"
},
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"LocaleKey": "DiskCategory",
"ZoneId": "${ZoneId}",
"InstanceType": "${InstanceType}",
"AutoSelectFirst": true,
"AutoChangeType": false
},
"Default": "cloud_essd"
},
"InstancePassword": {
"Type": "String",
"NoEcho": true,
"Label": {
"en": "インスタンスパスワード",
"zh-cn": "インスタンスパスワード"
},
"Description": {
"en": "サーバーのログインパスワード。長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。",
"zh-cn": "サーバーのログインパスワード。長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。"
},
"ConstraintDescription": {
"en": "長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。",
"zh-cn": "長さは 8~30 文字で、大文字、小文字、数字、特殊記号 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ のうち 3 種類を含める必要があります。"
},
"AssociationPropertyMetadata": {
"Visible": {
"Condition": {
"Fn::Equals": [
"${SelectInstance}",
false
]
}
}
},
"Default": null,
"AssociationProperty": "ALIYUN::ECS::Instance::Password"
}
},
"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_9966": {
"Type": "ALIYUN::ECS::SecurityGroupIngress",
"Properties": {
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp",
"NicType": "intranet",
"PortRange": "9966/9966"
}
},
"InstanceGroup": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"VSwitchId": {
"Ref": "VSwitch"
},
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"ImageId": "ubuntu_22_04",
"InstanceName": "ChatTTS",
"InstanceType": {
"Ref": "InstanceType"
},
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"Password": {
"Ref": "InstancePassword"
},
"IoOptimized": "optimized",
"MaxAmount": 1
}
}
},
"Outputs": {
},
"Metadata": {
}
}その他の例については、「このリソースを含むパブリックテンプレート」をご参照ください。