1 Star 1 Fork 0

无欢/阿里云ROS

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
GAME.yaml 2.72 KB
一键复制 编辑 原始数据 按行查看 历史
无欢 提交于 2024-07-13 14:27 +08:00 . update GAME.yaml
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Set up the 2048 game on an ECS instance..
zh-cn: 在ECS实例上搭建2048小游戏。
Parameters:
ZoneId:
Type: String
Label:
en: Availability Zone
zh-cn: 可用区ID
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例类型
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
DefaultValueStrategy: ecs.e-c1m2.large
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
InstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId: centos_7_9
InstanceName: GAME
InstanceType:
Ref: InstanceType
SystemDiskCategory : cloud_essd
IoOptimized: optimized
MaxAmount: 2
DS_Instances:
Type: DATASOURCE::ECS::Instances
Properties:
InstanceIds:
Fn::GetAtt:
- InstanceGroup
- InstanceIds
InstallGAME:
Type: ALIYUN::ECS::RunCommand
Properties:
InstanceIds:
Fn::GetAtt:
- InstanceGroup
- InstanceIds
Type: RunShellScript
Sync: true
Timeout: 1800
CommandContent: |
#!/bin/bash
yum install -y httpd wget
systemctl start httpd
wget 'https://computenest-artifacts-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/1853370294850618/cn-beijing/1697533575326/2048.tgz' -O 2048.tgz
tar xvf 2048.tgz
mv 2048/* /var/www/html && rm -rf 2048
Outputs:
GAMEUrl:
Description: GAME default address.
Value:
Fn::Sub:
- http://${IP}
- IP:
Fn::Jq:
- First
- if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress
end
- Fn::GetAtt:
- DS_Instances
- Instances
Metadata:
ALIYUN::ROS::Interface:
TemplateTags:
- acs:developer:gitee:0147-在ECS实例上搭建2048小游戏
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/a156da16/aliyunros.git
git@gitee.com:a156da16/aliyunros.git
a156da16
aliyunros
阿里云ROS
master

搜索帮助