alibabacloud-tech-solution-animation-creation-auto-deploy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Build AI Animation Story Creation App — Auto Deploy

构建AI动画故事创作应用 — 自动化部署

Automatically deploy the Alibaba Cloud "Build AI Animation Story Creation App" solution. Deployment stops once the application is accessible — the hands-on experience is left to the user.

Architecture:
OSS Bucket + DashScope (Bailian API Key) + FC App (ComfyUI + WebUI — two functions deployed via Devs template)

自动部署阿里云「构建AI动画故事创作应用」解决方案。部署在应用可访问时停止,后续实操体验交由用户自行完成。

架构:
OSS Bucket + DashScope (Bailian API Key) + FC App (ComfyUI + WebUI — 基于Devs模板部署的两个函数)

Installation

安装

Prerequisites (scripts/ runtime dependencies):
DependencyMin VersionCheck CommandPurpose
bash
4.0+
bash --version
Script runtime
aliyun
CLI
>= 3.3.7
aliyun version
Alibaba Cloud resource operations (3.3.7+ required for
ai-mode
subcommand)
python3
3.6+
python3 --version
JSON parsing
curl
any
curl --version
HTTP API calls
If Aliyun CLI is not installed or version too low, see
references/cli-installation-guide.md
for installation instructions. Then [MUST] run
aliyun configure set --auto-plugin-install true
to enable automatic plugin installation.

前置依赖(脚本/运行时依赖):
依赖项最低版本检查命令用途
bash
4.0+
bash --version
脚本运行时
aliyun
CLI
>= 3.3.7
aliyun version
阿里云资源操作(
ai-mode
子命令需要3.3.7及以上版本)
python3
3.6+
python3 --version
JSON解析
curl
任意版本
curl --version
HTTP API调用
若未安装Aliyun CLI或版本过低,请查看
references/cli-installation-guide.md
获取安装说明。 之后【必须】运行
aliyun configure set --auto-plugin-install true
以启用插件自动安装功能。

CLI Initialization (MUST run before Core Workflow)

CLI初始化(核心工作流前必须运行)

Enable AI-Mode, set the dedicated User-Agent, and update plugins so all subsequent CLI calls are tagged correctly and run on the latest plugin versions:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy"
aliyun plugin update

启用AI模式,设置专属User-Agent并更新插件,确保后续所有CLI调用都能正确标记并使用最新版本插件:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy"
aliyun plugin update

Authentication

身份验证

Pre-check: Alibaba Cloud Credentials Required
Security Rules:
  • NEVER read, echo, or print AK/SK values
  • NEVER ask the user to input AK/SK directly in the conversation or command line
  • NEVER use
    aliyun configure set
    with literal credential values
  • ONLY use
    aliyun configure list
    to check credential status
bash
aliyun configure list
Check the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
  1. Obtain credentials from Alibaba Cloud Console
  2. Configure credentials outside of this session
  3. Return and re-run after
    aliyun configure list
    shows a valid profile

预检查:需要阿里云凭证
安全规则:
  • 禁止读取、回显或打印AK/SK值
  • 禁止要求用户在对话或命令行中直接输入AK/SK
  • 禁止使用
    aliyun configure set
    传入明文凭证值
  • 仅允许使用
    aliyun configure list
    检查凭证状态
bash
aliyun configure list
检查输出中是否存在有效配置(AK、STS或OAuth身份)。
若无有效配置,请在此停止。
  1. 阿里云控制台获取凭证
  2. 在本会话外完成凭证配置
  3. aliyun configure list
    显示有效配置后再返回继续

RAM Policy

RAM权限策略

See
references/ram-policies.md
for full permission list.
Required system policies:
AliyunFCFullAccess
,
AliyunOSSFullAccess
Additional permissions: Devs-related permissions (
devs:CreateProject
,
devs:RenderServicesByTemplate
,
devs:UpdateEnvironment
,
devs:DeployEnvironment
,
devs:ListEnvironments
,
devs:GetEnvironment
)
Before the Core Workflow, automatically check and attach required policies:
bash
bash scripts/attach-policies.sh
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
  1. Read
    references/ram-policies.md
    to get the full list of permissions required by this SKILL
  2. Use
    ram-permission-diagnose
    skill to guide the user through requesting the necessary permissions
  3. Pause and wait until the user confirms that the required permissions have been granted

完整权限列表请查看
references/ram-policies.md
必需系统策略:
AliyunFCFullAccess
,
AliyunOSSFullAccess
额外权限: Devs相关权限(
devs:CreateProject
,
devs:RenderServicesByTemplate
,
devs:UpdateEnvironment
,
devs:DeployEnvironment
,
devs:ListEnvironments
,
devs:GetEnvironment
核心工作流开始前,自动检查并附加所需权限:
bash
bash scripts/attach-policies.sh
【必须】权限失败处理: 若执行过程中任何命令或API调用因权限错误失败,请遵循以下流程:
  1. 查看
    references/ram-policies.md
    获取本SKILL所需的完整权限列表
  2. 使用
    ram-permission-diagnose
    Skill引导用户申请必要权限
  3. 暂停操作,等待用户确认所需权限已授予

Parameter Confirmation

参数确认

IMPORTANT: Parameter Confirmation — Before executing any command or API call, all parameters are either fixed values or auto-generated/created — no manual user input required.
ParameterRequiredDescriptionValue
RegionId
YesDeployment region (FC and OSS in the same region)Fixed
cn-hangzhou
BUCKET_NAME
YesOSS Bucket nameAuto-generated
animation-story-<6 random lowercase letters>
API_KEY
YesBailian (DashScope) API KeyAuto-created via
aliyun modelstudio create-api-key
PROJECT_NAME
YesDevs project nameAuto-generated
animation-creation-<6 random lowercase letters>
Before starting the Core Workflow, set the following variables in the shell (all subsequent commands reference them directly):
bash
undefined
重要提示:参数确认 — 执行任何命令或API调用前,所有参数均为固定值或自动生成/创建,无需用户手动输入。
参数是否必需描述
RegionId
部署地域(FC与OSS需在同一地域)固定为
cn-hangzhou
BUCKET_NAME
OSS Bucket名称自动生成
animation-story-<6位随机小写字母>
API_KEY
Bailian(DashScope)API密钥通过
aliyun modelstudio create-api-key
自动创建
PROJECT_NAME
Devs项目名称自动生成
animation-creation-<6位随机小写字母>
核心工作流开始前,在Shell中设置以下变量(后续所有命令将直接引用这些变量):
bash
undefined

Generate random names

生成随机名称

BUCKET_NAME="animation-story-$(cat /dev/urandom | LC_ALL=C tr -dc 'a-z' | head -c 6)" PROJECT_NAME="animation-creation-$(cat /dev/urandom | LC_ALL=C tr -dc 'a-z' | head -c 6)" echo "BUCKET_NAME=$BUCKET_NAME, PROJECT_NAME=$PROJECT_NAME"

---
BUCKET_NAME="animation-story-$(cat /dev/urandom | LC_ALL=C tr -dc 'a-z' | head -c 6)" PROJECT_NAME="animation-creation-$(cat /dev/urandom | LC_ALL=C tr -dc 'a-z' | head -c 6)" echo "BUCKET_NAME=$BUCKET_NAME, PROJECT_NAME=$PROJECT_NAME"

---

Core Workflow

核心工作流

Step 1: Create Bailian API Key (CLI)

步骤1:创建Bailian API密钥(CLI)

Automatically obtain the workspace and create an API Key via
aliyun modelstudio
CLI:
bash
source scripts/create-api-key.sh
Note: Use
source
to ensure the
API_KEY
variable is exported to the current shell. The script automatically fetches the default workspace (or creates one if none exists), creates an API Key, and prints the full value.
通过
aliyun modelstudio
CLI自动获取工作区并创建API密钥:
bash
source scripts/create-api-key.sh
注意:使用
source
确保
API_KEY
变量导出至当前Shell。脚本会自动获取默认工作区(若不存在则创建)、生成API密钥并打印完整值。

Step 2: Enable OSS Service and Create Bucket (CLI)

步骤2:启用OSS服务并创建Bucket(CLI)

Note: The OSS CLI plugin uses the
--ua
flag (not
--user-agent
) to set the User-Agent.
First enable OSS service (returns
ORDER.OPEND
if already enabled — can be ignored):
bash
aliyun ossadmin open-oss-service --endpoint oss-admin.aliyuncs.com --force --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1 || true
Create Bucket:
bash
aliyun oss mb "oss://$BUCKET_NAME" --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
Verify:
bash
aliyun oss stat "oss://$BUCKET_NAME" --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
注意:OSS CLI插件使用
--ua
参数(而非
--user-agent
)设置User-Agent。
首先启用OSS服务(若已启用则返回
ORDER.OPEND
,可忽略):
bash
aliyun ossadmin open-oss-service --endpoint oss-admin.aliyuncs.com --force --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1 || true
创建Bucket:
bash
aliyun oss mb "oss://$BUCKET_NAME" --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
验证:
bash
aliyun oss stat "oss://$BUCKET_NAME" --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy

Step 3: Create Devs Project (CLI)

步骤3:创建Devs项目(CLI)

Use the
CreateProject
API to create a project. Specify the template name and parameters via
templateConfig
— Devs will automatically create a
production
environment.
Note: CreateProject only creates the project and an empty environment — it does NOT trigger deployment automatically. You must follow up with RenderServicesByTemplate + UpdateEnvironment + DeployEnvironment to complete deployment.
bash
aliyun devs create-project --body "{
  \"name\": \"$PROJECT_NAME\",
  \"spec\": {
    \"templateConfig\": {
      \"templateName\": \"animation-creation\",
      \"parameters\": {
        \"region\": \"cn-hangzhou\",
        \"bailian_api_key\": \"$API_KEY\",
        \"ossBucket\": \"$BUCKET_NAME\"
      }
    }
  }
}" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
Template parameter notes (confirmed — do not modify):
  • region
    : Fixed
    cn-hangzhou
  • bailian_api_key
    : Bailian API Key auto-created in Step 1
  • ossBucket
    : OSS Bucket name created in Step 2 (without
    oss://
    prefix)
  • All parameters are passed via
    parameters
    , not
    variableValues
使用
CreateProject
API创建项目,通过
templateConfig
指定模板名称和参数 — Devs将自动创建
production
环境。
注意:CreateProject仅创建项目和空环境,不会自动触发部署。必须执行RenderServicesByTemplate + UpdateEnvironment + DeployEnvironment才能完成部署。
bash
aliyun devs create-project --body "{
  \"name\": \"$PROJECT_NAME\",
  \"spec\": {
    \"templateConfig\": {
      \"templateName\": \"animation-creation\",
      \"parameters\": {
        \"region\": \"cn-hangzhou\",
        \"bailian_api_key\": \"$API_KEY\",
        \"ossBucket\": \"$BUCKET_NAME\"
      }
    }
  }
}" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
模板参数说明(已确认,请勿修改):
  • region
    :固定为
    cn-hangzhou
  • bailian_api_key
    :步骤1中自动创建的Bailian API密钥
  • ossBucket
    :步骤2中创建的OSS Bucket名称(不含
    oss://
    前缀)
  • 所有参数通过
    parameters
    传递,请勿使用
    variableValues

Step 4: Render Template and Configure Environment (CLI)

步骤4:渲染模板并配置环境(CLI)

All commands in this step use shell variables
MY_UID
,
PROJECT_NAME
,
BUCKET_NAME
,
API_KEY
— make sure Step 1 and Parameter Confirmation have been executed.
First obtain the current user UID and check the role trust policy:
bash
source scripts/setup-role.sh
Note: Use
source
to ensure the
MY_UID
variable is exported to the current shell. The script automatically checks whether the role exists and creates it if not. This role is the standard Devs role, typically auto-created when using the FC console's application feature for the first time.
本步骤所有命令使用Shell变量
MY_UID
,
PROJECT_NAME
,
BUCKET_NAME
,
API_KEY
— 确保已执行步骤1和参数确认。
首先获取当前用户UID并检查角色信任策略:
bash
source scripts/setup-role.sh
注意:使用
source
确保
MY_UID
变量导出至当前Shell。脚本会自动检查角色是否存在,若不存在则创建。该角色为标准Devs角色,通常首次使用FC控制台应用功能时会自动创建。

4a. Render Template → Build JSON → Update Environment (all-in-one script)

4a. 渲染模板 → 构建JSON → 更新环境(一站式脚本)

The following script automatically: renders the template → filters out custom-domain → adds roleArn → calls UpdateEnvironment. The agent does not need to handle JSON manually.
bash
bash scripts/render-and-update.sh
Key notes (built into the script — no manual handling needed):
  • custom-domain
    service is automatically filtered out (causes "Unknown service type" error)
  • roleArn
    is automatically added
  • Uses
    --body
    to pass data (
    --spec
    cannot correctly pass deeply nested JSON)
以下脚本自动完成:渲染模板 → 过滤自定义域名 → 添加roleArn → 调用UpdateEnvironment。无需手动处理JSON。
bash
bash scripts/render-and-update.sh
关键说明(已内置到脚本中,无需手动处理):
  • 自动过滤
    custom-domain
    服务(会导致「未知服务类型」错误)
  • 自动添加
    roleArn
  • 使用
    --body
    传递数据(
    --spec
    无法正确传递深层嵌套JSON)

4b. Trigger Deployment

4b. 触发部署

Built-in rate-limit protection: The script retries up to 3 times with 60-second intervals, and stops immediately on 404. Run the script directly — do not call
deploy-environment
manually.
bash
bash scripts/deploy-environment.sh
内置限流保护:脚本最多重试3次,间隔60秒,遇到404错误立即停止。直接运行脚本,请勿手动调用
deploy-environment
bash
bash scripts/deploy-environment.sh

Step 5: Poll Deployment Status

步骤5:轮询部署状态

Deployment is asynchronous — poll until complete (typically takes 5–15 minutes). Run the following script directly:
bash
bash scripts/poll-deploy-status.sh
部署为异步操作 — 轮询直至完成(通常需要5–15分钟)。直接运行以下脚本:
bash
bash scripts/poll-deploy-status.sh

Step 6: Create Custom Domain

步骤6:创建自定义域名

Why is a custom domain needed? FC trigger URLs (
*.fcapp.run
) force a
Content-Disposition: attachment
response header, causing the browser to download the HTML instead of rendering it. A custom domain (
*.devsapp.net
) is required for the application to work properly.
Must use FC 2.0 API (
aliyun fc-open
)
to create the helper function: FC 3.0 does not support
$
in function names. The
fc-open
plugin will be auto-installed via the
--auto-plugin-install true
configuration.
Run the following complete script directly (only
MY_UID
and
PROJECT_NAME
variables need to be set):
bash
bash scripts/create-custom-domain.sh
为何需要自定义域名?FC触发URL(
*.fcapp.run
)强制添加
Content-Disposition: attachment
响应头,导致浏览器下载HTML而非渲染页面。必须使用自定义域名(
*.devsapp.net
)才能确保应用正常运行。
必须使用FC 2.0 API(
aliyun fc-open
)创建辅助函数:FC 3.0不支持函数名称中包含
$
fc-open
插件将通过
--auto-plugin-install true
配置自动安装。
直接运行以下完整脚本(仅需设置
MY_UID
PROJECT_NAME
变量):
bash
bash scripts/create-custom-domain.sh

Step 7: Get Access URL (stop here)

步骤7:获取访问URL(在此停止)

The access URL is automatically printed at the end of the Step 6 script. Format:
text
http://${PROJECT_NAME}-web.fcv3.${MY_UID}.cn-hangzhou.fc.devsapp.net/
Stop here. Provide the access URL from Step 6 output to the user and let them experience the app on their own. Do not operate the application on behalf of the user.
⚠️ 安全提醒 — 展示访问 URL 时必须告知用户: 该 URL 可通过公网直接访问,请勿随意分享给不信任的人。未经授权的访问可能导致:
  • 云资源被消耗: 每次访问都会消耗函数计算资源和百炼 API 调用额度,可能产生额外费用。
  • 隐私信息泄露: 生成的动画故事、上传的图片等内容可能包含个人或敏感信息。

访问URL会在步骤6脚本末尾自动打印,格式如下:
text
http://${PROJECT_NAME}-web.fcv3.${MY_UID}.cn-hangzhou.fc.devsapp.net/
在此停止。将步骤6输出的访问URL提供给用户,让其自行体验应用。请勿代用户操作应用。
⚠️ 安全提醒 — 展示访问URL时必须告知用户: 该URL可通过公网直接访问,请勿随意分享给不信任的人。未经授权的访问可能导致:
  • 云资源被消耗: 每次访问都会消耗函数计算资源和百炼API调用额度,可能产生额外费用。
  • 隐私信息泄露: 生成的动画故事、上传的图片等内容可能包含个人或敏感信息。

Cleanup

资源清理

To clean up deployed resources, delete in the following order (requires
PROJECT_NAME
,
MY_UID
,
BUCKET_NAME
,
API_KEY_ID
variables):
bash
undefined
如需清理已部署资源,请按以下顺序删除(需
PROJECT_NAME
,
MY_UID
,
BUCKET_NAME
,
API_KEY_ID
变量):
bash
undefined

1. Delete FC custom domain

1. 删除FC自定义域名

aliyun fc delete-custom-domain --domain-name "${PROJECT_NAME}-web.fcv3.${MY_UID}.cn-hangzhou.fc.devsapp.net" --region cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
aliyun fc delete-custom-domain --domain-name "${PROJECT_NAME}-web.fcv3.${MY_UID}.cn-hangzhou.fc.devsapp.net" --region cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy

2. Delete Devs project (also deletes associated FC functions; --force true skips environment resource check)

2. 删除Devs项目(同时删除关联的FC函数;--force true跳过环境资源检查)

aliyun devs delete-project --name "$PROJECT_NAME" --force true --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
aliyun devs delete-project --name "$PROJECT_NAME" --force true --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy

3. Delete OSS Bucket (recursively delete all objects first, then delete the Bucket)

3. 删除OSS Bucket(先递归删除所有对象,再删除Bucket)

aliyun oss rm "oss://$BUCKET_NAME" -r -f --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy aliyun oss rm "oss://$BUCKET_NAME" -b -f --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
aliyun oss rm "oss://$BUCKET_NAME" -r -f --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy aliyun oss rm "oss://$BUCKET_NAME" -b -f --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy

4. Delete Bailian API Key (API_KEY_ID is output during create-api-key.sh execution)

4. 删除Bailian API密钥(API_KEY_ID在create-api-key.sh执行时输出)

aliyun modelstudio delete-api-key --api-key-id "$API_KEY_ID" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy

---
aliyun modelstudio delete-api-key --api-key-id "$API_KEY_ID" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy

---

Workflow Teardown

工作流收尾

After the workflow completes (or after Cleanup), disable AI-Mode:
bash
aliyun configure ai-mode disable

工作流完成(或资源清理后),禁用AI模式:
bash
aliyun configure ai-mode disable

Cannot-via-CLI/SDK Summary

无法通过CLI/SDK完成的操作汇总

See
references/related-commands.md
for full CLI command reference.
Key limitation: First-time activation of FC has no CLI/API support — users must activate it manually in the console.
Auto-activated: OSS service via
aliyun ossadmin open-oss-service
(built into Step 2). Bailian workspace via
aliyun modelstudio create-workspace
(built into Step 1).

完整CLI命令参考请查看
references/related-commands.md
关键限制: FC首次激活无CLI/API支持 — 用户必须在控制台手动激活。
已自动激活: 通过
aliyun ossadmin open-oss-service
自动激活OSS服务(内置到步骤2)。通过
aliyun modelstudio create-workspace
自动激活百炼工作区(内置到步骤1)。

Best Practices

最佳实践

  1. Region is fixed to
    cn-hangzhou
    (FC and OSS in the same region)
  2. DashScope API Key is passed via Devs template parameters — not hardcoded
  3. OSS Bucket names include a random suffix to avoid conflicts
  4. Record the access URL and created resources after deployment completes

  1. 地域固定为
    cn-hangzhou
    (FC与OSS需在同一地域)
  2. DashScope API密钥通过Devs模板参数传递,而非硬编码
  3. OSS Bucket名称包含随机后缀以避免冲突
  4. 部署完成后记录访问URL和已创建资源

Reference Links

参考链接

ReferenceDescription
references/ram-policies.mdRAM permission policies
references/related-commands.mdCLI/SDK command reference
references/verification-method.mdDeployment verification steps
references/acceptance-criteria.mdAcceptance criteria
references/cli-installation-guide.mdCLI installation guide
参考文档描述
references/ram-policies.mdRAM权限策略
references/related-commands.mdCLI/SDK命令参考
references/verification-method.md部署验证步骤
references/acceptance-criteria.md验收标准
references/cli-installation-guide.mdCLI安装指南