
Alibabacloud Tech Solution Animation Creation Auto Deploy
- 379 installs
- 208 repo stars
- Updated August 4, 2026
- aliyun/alibabacloud-aiops-skills
alibabacloud-tech-solution-animation-creation-auto-deploy is a Claude Code skill that creates Alibaba Cloud tech-solution animations and auto-deploys them to hosting endpoints for developers who need publish-ready motion
About
alibabacloud-tech-solution-animation-creation-auto-deploy is a cloud automation skill from aliyun/alibabacloud-aiops-skills that produces Alibaba Cloud tech-solution animations and deploys them to hosting endpoints in one workflow. It targets sales teams, product demos, and launch channels that need motion assets published quickly without manual upload steps. Developers on Alibaba Cloud reach for this skill when a tech-solution story needs animated visuals deployed to a live endpoint for presentations, marketing pages, or customer-facing demos.
- Automated tech-solution animation generation for Alibaba Cloud
- Single pipeline from creation through deployment
- Launch and sales-enablement motion asset tooling
- Cuts manual design, export, and release steps
- Pairs generative media with cloud solution narratives
Alibabacloud Tech Solution Animation Creation Auto Deploy by the numbers
- 379 all-time installs (skills.sh)
- Ranked #450 of 1,335 Generative Media skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aliyun/alibabacloud-aiops-skills --skill alibabacloud-tech-solution-animation-creation-auto-deployAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 379 |
|---|---|
| repo stars | ★ 208 |
| Last updated | August 4, 2026 |
| Repository | aliyun/alibabacloud-aiops-skills ↗ |
How do you auto-deploy tech solution animations on Alibaba Cloud?
Create Alibaba Cloud tech-solution animations and auto-deploy them to hosting endpoints so sales, demos, and launch channels get publish-ready motion assets fast.
Who is it for?
Developers and solutions engineers on Alibaba Cloud who need tech-solution animations created and auto-deployed to live hosting for demos and launch channels.
Skip if: Non-Alibaba Cloud deployments, static blog SVG charts, or general-purpose motion design without cloud auto-publish requirements.
When should I use this skill?
User asks to create Alibaba Cloud tech-solution animations, auto-deploy motion assets, or publish demo animations to hosting endpoints.
What you get
Published tech-solution animation assets hosted on Alibaba Cloud endpoints ready for sales demos and launch distribution
- Tech-solution animation assets
- Deployed hosting endpoint URLs
Files
Build AI Animation Story Creation App — Auto Deploy
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) ---
Installation
Prerequisites (scripts/ runtime dependencies):
>
| Dependency | Min Version | Check Command | Purpose |
|-----------|-------------|---------------|---------|
|bash| 4.0+ |bash --version| Script runtime |
|aliyunCLI | >= 3.3.7 |aliyun version| Alibaba Cloud resource operations (3.3.7+ required forai-modesubcommand) |
|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.---
CLI Initialization (MUST run before Core Workflow)
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:
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---
RAM Policy
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 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 SKILL2. Use ram-permission-diagnose skill to guide the user through requesting the necessary permissions3. Pause and wait until the user confirms that the required permissions have been granted
---
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.
| Parameter | Required | Description | Value |
|---|---|---|---|
RegionId | Yes | Deployment region (FC and OSS in the same region) | Fixed `cn-hangzhou` |
BUCKET_NAME | Yes | OSS Bucket name | Auto-generated animation-story-<6 random lowercase letters> |
API_KEY | Yes | Bailian (DashScope) API Key | Auto-created via aliyun modelstudio create-api-key |
PROJECT_NAME | Yes | Devs project name | Auto-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):
# 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"---
Core Workflow
Step 1: Create Bailian API Key (CLI)
Automatically obtain the workspace and create an API Key via aliyun modelstudio CLI:
source scripts/create-api-key.shNote: Usesourceto ensure theAPI_KEYvariable 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.
Step 2: Enable OSS Service and Create Bucket (CLI)
Note: The OSS CLI plugin uses the--uaflag (not--user-agent) to set the User-Agent.
First enable OSS service (returns ORDER.OPEND if already enabled — can be ignored):
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 || trueCreate Bucket:
aliyun oss mb "oss://$BUCKET_NAME" --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deployVerify:
aliyun oss stat "oss://$BUCKET_NAME" --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deployStep 3: Create Devs Project (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.
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-deployTemplate parameter notes (confirmed — do not modify):
-region: Fixedcn-hangzhou
- bailian_api_key: Bailian API Key auto-created in Step 1-ossBucket: OSS Bucket name created in Step 2 (withoutoss://prefix)
- All parameters are passed viaparameters, notvariableValues
Step 4: Render Template and Configure Environment (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:
source scripts/setup-role.shNote: Usesourceto ensure theMY_UIDvariable 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.
4a. Render Template → Build JSON → Update Environment (all-in-one script)
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 scripts/render-and-update.shKey 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--bodyto pass data (--speccannot correctly pass deeply nested JSON)
4b. Trigger Deployment
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 scripts/deploy-environment.shStep 5: Poll Deployment Status
Deployment is asynchronous — poll until complete (typically takes 5–15 minutes). Run the following script directly:
bash scripts/poll-deploy-status.shStep 6: Create Custom Domain
Why is a custom domain needed? FC trigger URLs (*.fcapp.run) force aContent-Disposition: attachmentresponse 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. Thefc-openplugin will be auto-installed via the--auto-plugin-install trueconfiguration.
Run the following complete script directly (only `MY_UID` and `PROJECT_NAME` variables need to be set):
bash scripts/create-custom-domain.shStep 7: Get Access URL (stop here)
The access URL is automatically printed at the end of the Step 6 script. Format:
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 调用额度,可能产生额外费用。
- 隐私信息泄露: 生成的动画故事、上传的图片等内容可能包含个人或敏感信息。
---
Cleanup
To clean up deployed resources, delete in the following order (requires PROJECT_NAME, MY_UID, BUCKET_NAME, API_KEY_ID variables):
# 1. Delete FC custom domain
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)
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)
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)
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:
aliyun configure ai-mode disable---
Cannot-via-CLI/SDK Summary
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 viaaliyun ossadmin open-oss-service(built into Step 2). Bailian workspace viaaliyun modelstudio create-workspace(built into Step 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
---
Reference Links
| Reference | Description |
|---|---|
| references/ram-policies.md | RAM permission policies |
| references/related-commands.md | CLI/SDK command reference |
| references/verification-method.md | Deployment verification steps |
| references/acceptance-criteria.md | Acceptance criteria |
| references/cli-installation-guide.md | CLI installation guide |
Acceptance Criteria: Build AI Animation Story Creation App
Scenario: Build AI Animation Story Creation App — Auto Deploy Purpose: Skill testing acceptance criteria
---
Correct CLI Command Patterns
1. OSS — Product: oss
✅ CORRECT
aliyun oss mb oss://my-animation-bucket --region cn-hangzhou --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
aliyun oss stat oss://my-animation-bucket --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy❌ INCORRECT
# Wrong: using ossutil as separate command
ossutil mb oss://my-bucket2. Devs — Product: devs (FC app template deployment)
✅ CORRECT
# Create project (with template config, parameter names confirmed)
aliyun devs create-project --body '{"name":"my-project","spec":{"templateConfig":{"templateName":"animation-creation","parameters":{"region":"cn-hangzhou","bailian_api_key":"sk-xxx","ossBucket":"my-bucket"}}}}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# Render template (must pass namespace, otherwise functionName starts with "-" causing deployment failure)
aliyun devs render-services-by-template --template-name animation-creation --project-name my-project --variable-values '{"shared":{"namespace":"my-project"}}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# Update environment (must use --body; --spec cannot correctly handle deeply nested JSON; must include roleArn; only comfyui and web services)
aliyun devs update-environment --project-name my-project --name production --body '{"name":"production","spec":{"roleArn":"acs:ram::123456:role/aliyundevscustomrole","stagedConfigs":{"services":{"comfyui":{...},"web":{...}}}}}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# Trigger deployment
aliyun devs deploy-environment --project-name my-project --name production --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# Query environment details
aliyun devs get-environment --project-name my-project --name production --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy❌ INCORRECT
# Wrong: using fc create-function instead of devs template (this solution requires template deployment)
aliyun fc create-function --function-name my-func --runtime python3.10 --handler index.handler
# Wrong: using old fc-open product
aliyun fc-open create-function --service-name svc --function-name func
# Wrong: using variableValues instead of parameters for template variables
aliyun devs create-project --body '{"name":"my-project","spec":{"templateConfig":{"templateName":"animation-creation","variableValues":{"bailian_api_key":{"value":"sk-xxx"}}}}}'
# Wrong: wrong parameter names (bucketName instead of ossBucket, dashScopeApiKey instead of bailian_api_key)
aliyun devs create-project --body '{"name":"my-project","spec":{"templateConfig":{"templateName":"animation-creation","parameters":{"bucketName":"my-bucket","dashScopeApiKey":"sk-xxx"}}}}'
# Wrong: putting custom-domain service in UpdateEnvironment (causes "Unknown service type" error)
aliyun devs update-environment --spec '{"stagedConfigs":{"services":{"comfyui":{...},"web":{...},"custom-domain":{...}}}}'
# Wrong: missing roleArn in UpdateEnvironment
aliyun devs update-environment --spec '{"stagedConfigs":{"services":{"comfyui":{...},"web":{...}}}}'
# Wrong: using --spec instead of --body for UpdateEnvironment (deep-nested JSON gets corrupted)
aliyun devs update-environment --spec '{"roleArn":"...","stagedConfigs":{"services":{...}}}'
# Wrong: not passing namespace to render-services-by-template (functionName becomes "-comfyui", fails FC naming rule)
aliyun devs render-services-by-template --template-name animation-creation --project-name my-project
# Wrong: expecting CreateProject to auto-deploy (it only creates project + empty environment)
# Must follow up with render → update-environment → deploy-environment3. FC Custom Domain — Product: fc
✅ CORRECT
# Get domain verification token (use --data-urlencode)
curl -s --connect-timeout 10 --max-time 30 -A AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy -X POST "https://domain.devsapp.net/token" \
--data-urlencode "type=fc" --data-urlencode "user=<UID>" \
--data-urlencode "region=cn-hangzhou" --data-urlencode "service=fcv3" \
--data-urlencode "function=<ProjectName>-web"
# Helper function uses FC 2.0 API (fc-open)
aliyun fc-open create-service --body '{"serviceName":"serverless-devs-check"}' --region cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
aliyun fc-open create-function --service-name serverless-devs-check --body '<JSON>' --region cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# Create FC custom domain
aliyun fc create-custom-domain --body '{"domainName":"<DOMAIN>","protocol":"HTTP","routeConfig":{"routes":[...]}}' --region cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy❌ INCORRECT
# Wrong: using FC trigger URL as access URL (adds Content-Disposition: attachment, browser downloads instead of rendering)
# https://<func>.cn-hangzhou.fcapp.run is NOT a valid application URL
# Wrong: using FC 3.0 API for helper function (function name with $ not supported)
aliyun fc create-function --function-name "serverless-devs-check$domain<TOKEN>" ...
# Wrong: using -F instead of --data-urlencode for curl (causes "failed to change user ID" error)
curl -X POST "https://domain.devsapp.net/token" -F "user=<UID>" ...
# Wrong: not cleaning up helper function after domain creation
# Must delete trigger, function, and service from serverless-devs-check after domain is registered---
Key Validation Points
1. Template parameters are passed via parameters, not variableValues 2. Confirmed template parameter names: region (fixed cn-hangzhou), bailian_api_key, ossBucket 3. FC application is deployed via Devs API, not aliyun fc create-function 4. Template name is animation-creation 5. DashScope API Key — auto-created via aliyun modelstudio create-api-key (requires list-workspaces first to get workspace-id) 6. OSS Bucket creation uses aliyun oss mb 7. UpdateEnvironment must include roleArn (format: acs:ram::<UID>:role/aliyundevscustomrole) 8. UpdateEnvironment services must NOT include `custom-domain` (only comfyui and web) 9. UpdateEnvironment must use `--body`, not --spec (CLI cannot correctly serialize deeply nested JSON) 10. render-services-by-template must pass `--variable-values '{"shared":{"namespace":"<ProjectName>"}}'`, otherwise function names start with - 11. Full deployment chain: CreateProject → RenderServicesByTemplate → UpdateEnvironment → DeployEnvironment → GetEnvironment polling → Create custom domain 12. Deployment status is queried via aliyun devs get-environment, waiting for both comfyui and web latestDeployment.phase to be "Finished" 13. FC trigger URL (*.fcapp.run) cannot be used as the application URL (forces Content-Disposition: attachment) — a custom domain must be created 14. Custom domain is registered via the devsapp.net community DNS service + FC CreateCustomDomain API 15. Helper function must use FC 2.0 API (aliyun fc-open) — FC 3.0 does not support $ in function names 16. Domain format: <ProjectName>-web.fcv3.<UID>.cn-hangzhou.fc.devsapp.net 17. Access URL is the custom domain http://<DOMAIN>/ (HTTP protocol) 18. All aliyun CLI commands must include User-Agent: OSS commands use --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy, all others use --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
Aliyun CLI Installation & Configuration Guide
Complete guide for installing and configuring Aliyun CLI.
Aliyun CLI 3.3.1+: Supports installing and using all published Alibaba Cloud product plugins. Make sure to upgrade to 3.3.1 or later for full plugin ecosystem coverage.
Installation
macOS
Using Homebrew (Recommended)
brew install aliyun-cli
# Upgrade to latest
brew upgrade aliyun-cli
# Verify version (>= 3.3.1)
aliyun versionUsing Binary
# Download
wget https://aliyuncli.alicdn.com/aliyun-cli-macosx-latest-amd64.tgz
# Extract
tar -xzf aliyun-cli-macosx-latest-amd64.tgz
# Move to PATH
sudo mv aliyun /usr/local/bin/
# Verify
aliyun versionLinux
Debian/Ubuntu
# Download
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz
# Extract and install
tar -xzf aliyun-cli-linux-latest-amd64.tgz
sudo mv aliyun /usr/local/bin/
# Verify
aliyun versionCentOS/RHEL
# Download
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz
# Extract and install
tar -xzf aliyun-cli-linux-latest-amd64.tgz
sudo mv aliyun /usr/local/bin/
# Verify
aliyun versionARM64 Architecture
# Download ARM64 version
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-arm64.tgz
# Extract and install
tar -xzf aliyun-cli-linux-latest-arm64.tgz
sudo mv aliyun /usr/local/bin/Windows
Using Binary 1. Download from: https://aliyuncli.alicdn.com/aliyun-cli-windows-latest-amd64.zip 2. Extract the ZIP file 3. Add the directory to your PATH environment variable 4. Open new Command Prompt or PowerShell 5. Verify: aliyun version
Using PowerShell
# Download
Invoke-WebRequest -Uri "https://aliyuncli.alicdn.com/aliyun-cli-windows-latest-amd64.zip" -OutFile "aliyun-cli.zip"
# Extract
Expand-Archive -Path aliyun-cli.zip -DestinationPath C:\aliyun-cli
# Add to PATH (requires admin privileges)
$env:Path += ";C:\aliyun-cli"
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine)
# Verify
aliyun versionConfiguration
Quick Start
aliyun configure set \
--mode AK \
--access-key-id <your-access-key-id> \
--access-key-secret <your-access-key-secret> \
--region cn-hangzhouAll aliyun configure commands support non-interactive flags, which is the recommended approach — it works in scripts, CI/CD pipelines, and agent-driven automation without hanging on stdin prompts.
Where to Get Access Keys
1. Log in to Aliyun Console: https://ram.console.aliyun.com/ 2. Navigate to: AccessKey Management 3. Create a new AccessKey pair 4. Save the secret immediately — it's only shown once
Configuration Modes
Aliyun CLI supports 6 authentication modes. All examples below use non-interactive flags.
1. AK Mode (Access Key)
Most common mode for personal accounts and scripts.
aliyun configure set \
--mode AK \
--access-key-id LTAI5tXXXXXXXX \
--access-key-secret 8dXXXXXXXXXXXXXXXXXXXXXXXX \
--region cn-hangzhouConfiguration is stored in ~/.aliyun/config.json:
{
"current": "default",
"profiles": [
{
"name": "default",
"mode": "AK",
"access_key_id": "LTAI5tXXXXXXXX",
"access_key_secret": "8dXXXXXXXXXXXXXXXXXXXXXXXX",
"region_id": "cn-hangzhou",
"output_format": "json",
"language": "en"
}
]
}2. StsToken Mode (Temporary Credentials)
For short-lived access (tokens expire in 1-12 hours).
aliyun configure set \
--mode StsToken \
--access-key-id LTAI5tXXXXXXXX \
--access-key-secret 8dXXXXXXXXXXXXXXXXXXXXXXXX \
--sts-token v1.0:XXXXXXXXXXXXXXXX \
--region cn-hangzhouUse cases: CI/CD pipelines, temporary access for external contractors, cross-account access.
3. RamRoleArn Mode (Assume RAM Role)
Assume a RAM role for elevated or cross-account access.
aliyun configure set \
--mode RamRoleArn \
--access-key-id LTAI5tXXXXXXXX \
--access-key-secret 8dXXXXXXXXXXXXXXXXXXXXXXXX \
--ram-role-arn acs:ram::123456789012:role/AdminRole \
--role-session-name my-session \
--region cn-hangzhouUse cases: cross-account resource access, temporary elevated privileges, role-based access control.
4. EcsRamRole Mode (ECS Instance RAM Role)
Use the RAM role attached to an ECS instance — no credentials needed.
aliyun configure set \
--mode EcsRamRole \
--ram-role-name MyEcsRole \
--region cn-hangzhouRequirements: must be running on an ECS instance with a RAM role attached.
Use cases: scripts and automation running on ECS instances.
5. RsaKeyPair Mode (RSA Key Pair)
Use RSA key pair for authentication (generate key pair in Aliyun Console first).
aliyun configure set \
--mode RsaKeyPair \
--private-key /path/to/private-key.pem \
--key-pair-name my-key-pair \
--region cn-hangzhou6. RamRoleArnWithEcs Mode (ECS + RAM Role)
Combine ECS instance role with RAM role assumption for cross-account access from ECS.
aliyun configure set \
--mode RamRoleArnWithEcs \
--ram-role-name MyEcsRole \
--ram-role-arn acs:ram::123456789012:role/TargetRole \
--role-session-name my-session \
--region cn-hangzhouEnvironment Variables
Highest priority - overrides config file
Access Key Mode
export ALIBABA_CLOUD_ACCESS_KEY_ID=your_access_key_id
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your_access_key_secret
export ALIBABA_CLOUD_REGION_ID=cn-hangzhouSTS Token Mode
export ALIBABA_CLOUD_ACCESS_KEY_ID=your_access_key_id
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your_access_key_secret
export ALIBABA_CLOUD_SECURITY_TOKEN=your_sts_token
export ALIBABA_CLOUD_REGION_ID=cn-hangzhouECS RAM Role Mode
export ALIBABA_CLOUD_ECS_METADATA=role_nameUse Case:
- CI/CD pipelines
- Docker containers
- Temporary credential override
Managing Multiple Profiles
Create Named Profiles
aliyun configure set --profile projectA \
--mode AK \
--access-key-id LTAI5tAAAAAAAA \
--access-key-secret 8dAAAAAAAAAAAAAAAAAAAAAAAA \
--region cn-hangzhou
aliyun configure set --profile projectB \
--mode AK \
--access-key-id LTAI5tBBBBBBBB \
--access-key-secret 8dBBBBBBBBBBBBBBBBBBBBBBBB \
--region cn-shanghaiUse Specific Profile
aliyun ecs describe-instances --profile projectA
export ALIBABA_CLOUD_PROFILE=projectA
aliyun ecs describe-instances # Uses projectAList and Switch Profiles
aliyun configure list # List all profiles
aliyun configure set --current projectA # Switch default profileCredential Priority
Credentials are loaded in this order (first found wins):
1. Command-line flag: --profile <name> 2. Environment variable: ALIBABA_CLOUD_PROFILE 3. Environment credentials: ALIBABA_CLOUD_ACCESS_KEY_ID, etc. 4. Configuration file: ~/.aliyun/config.json (current profile) 5. ECS Instance RAM Role: If running on ECS with attached role
Verification
Test Authentication
# Basic test - list regions
aliyun ecs describe-regions
# Expected output: JSON array of regionsIf successful, you'll see:
{
"Regions": {
"Region": [
{
"RegionId": "cn-hangzhou",
"RegionEndpoint": "ecs.cn-hangzhou.aliyuncs.com",
"LocalName": "华东 1(杭州)"
},
...
]
},
"RequestId": "..."
}If failed, you'll see error messages:
InvalidAccessKeyId.NotFound- Wrong Access Key IDSignatureDoesNotMatch- Wrong Access Key SecretInvalidSecurityToken.Expired- STS token expired (for StsToken mode)Forbidden.RAM- Insufficient permissions
Debug Configuration
# Show current configuration
aliyun configure get
# Test with debug logging
aliyun ecs describe-regions --log-level=debug
# Check credential provider
aliyun configure get modeSecurity Best Practices
1. Use RAM Users (Not Root Account)
❌ Don't: Use Aliyun root account credentials ✅ Do: Create RAM users with specific permissions
# Create RAM user in console
# Attach only necessary policies
# Use RAM user's access keys2. Principle of Least Privilege
Grant only the minimum permissions needed:
# Example: Read-only ECS access
# Attach policy: AliyunECSReadOnlyAccess3. Rotate Access Keys Regularly
# Create new access key in RAM Console, then update configuration
aliyun configure set --access-key-id NEW_KEY --access-key-secret NEW_SECRET
# Delete old access key from console4. Use STS Tokens for Temporary Access
aliyun configure set --mode StsToken \
--access-key-id XXXX --access-key-secret XXXX \
--sts-token XXXX --region cn-hangzhou5. Use ECS RAM Roles When Possible
aliyun configure set --mode EcsRamRole --ram-role-name MyRole --region cn-hangzhou6. Never Commit Credentials
# Add to .gitignore
echo "~/.aliyun/config.json" >> .gitignore
# Use environment variables in CI/CD instead7. Secure Config File
# Restrict permissions
chmod 600 ~/.aliyun/config.jsonTroubleshooting
Issue: Command Not Found
# Check installation
which aliyun
# Check PATH
echo $PATH
# Reinstall or add to PATHIssue: Authentication Failed
# Verify configuration
aliyun configure get
# Test with debug
aliyun ecs describe-regions --log-level=debug
# Check credentials in console
# Verify access key is activeIssue: Permission Denied
# Error: Forbidden.RAM
# Check RAM user permissions
# Attach necessary policies in RAM console
# Example: AliyunECSFullAccess for ECS operationsIssue: STS Token Expired
# Error: InvalidSecurityToken.Expired
# Reconfigure with new token
aliyun configure set --mode StsToken \
--access-key-id XXXX --access-key-secret XXXX \
--sts-token NEW_TOKEN --region cn-hangzhouIssue: Wrong Region
# Some resources may not exist in the specified region
# Check available regions
aliyun ecs describe-regions
# Update default region
aliyun configure set region cn-shanghaiAdvanced Configuration
Custom Endpoint
# Use custom or private endpoint
export ALIBABA_CLOUD_ECS_ENDPOINT=ecs-vpc.cn-hangzhou.aliyuncs.comProxy Settings
# HTTP proxy
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
# No proxy for specific domains
export NO_PROXY=localhost,127.0.0.1,.aliyuncs.comTimeout Settings
# Connection timeout (default: 10s)
export ALIBABA_CLOUD_CONNECT_TIMEOUT=30
# Read timeout (default: 10s)
export ALIBABA_CLOUD_READ_TIMEOUT=30Next Steps
After installation and configuration:
1. Install plugins for services you need (v3.3.1+ supports all published product plugins):
aliyun plugin install --names ecs vpc rds
# List all available plugins
aliyun plugin list-remote2. Explore commands:
aliyun ecs --help
aliyun fc --help3. Read documentation:
- Command Syntax Guide
- Global Flags Reference
- Common Scenarios
References
- Official Documentation: https://help.aliyun.com/zh/cli/
- RAM Console: https://ram.console.aliyun.com/
- Access Key Management: https://ram.console.aliyun.com/manage/ak
- Plugin Repository: https://github.com/aliyun/aliyun-cli
RAM Policies: Build AI Animation Story Creation App
Scenario: Build AI Animation Story Creation App (Auto Deploy)
---
Required RAM Permissions
1. Devs (Serverless Development Platform)
| Action | Description | Used In |
|---|---|---|
devs:CreateProject | Create project with template configuration | Step 3 |
devs:RenderServicesByTemplate | Render template to get service configuration | Step 4a |
devs:UpdateEnvironment | Update environment configuration (write services and roleArn) | Step 4a |
devs:DeployEnvironment | Trigger environment deployment | Step 4b |
devs:ListEnvironments | List project environments | Step 5 |
devs:GetEnvironment | Query environment details and deployment status | Step 5 |
2. FC (Function Compute 3.0)
Devs template deployment internally requires FC permissions to create functions and triggers. Custom domain creation also requires FC permissions.
| Action | Description | Used In |
|---|---|---|
fc:CreateFunction | Create function | Devs internal call |
fc:GetFunction | Query function details | Devs internal call |
fc:CreateTrigger | Create trigger | Devs internal call |
fc:CreateCustomDomain | Create custom domain | Step 6 |
fc:DeleteCustomDomain | Delete custom domain (cleanup) | Resource cleanup |
System policy: AliyunFCFullAccess
3. OSS (Object Storage Service)
| Action | Description | Used In |
|---|---|---|
oss:PutBucket | Create Bucket | Step 2 |
oss:GetBucketInfo | Query Bucket info | Step 2 verification |
oss-admin:OpenOssService | Enable OSS service | Step 2 |
System policy: AliyunOSSFullAccess
4. STS
| Action | Description | Used In |
|---|---|---|
sts:GetCallerIdentity | Get current user UID (to construct roleArn) | Step 4 |
5. RAM
| Action | Description | Used In |
|---|---|---|
ram:GetRole | Query role trust policy | Step 4 |
ram:CreateRole | Create role (auto-create if role does not exist) | Step 4 |
ram:UpdateRole | Update role trust policy (add FC service trust) | Step 4 |
ram:AttachPolicyToUser | Attach system policy to RAM user | RAM Policy pre-check |
6. DashScope / MaaS (Bailian)
Bailian API Key is automatically created and managed via the aliyun maas CLI plugin.| Action | Description | Used In |
|---|---|---|
maas:ListWorkspaces | Get workspace list | Step 1 |
maas:CreateWorkspace | Create workspace (auto-create if none exists) | Step 1 |
maas:CreateApiKey | Create API Key | Step 1 |
maas:DeleteApiKey | Delete API Key (cleanup) | Resource cleanup |
---
Recommended System Policies
| Policy | Description |
|---|---|
AliyunFCFullAccess | Full access to Function Compute |
AliyunOSSFullAccess | Full access to OSS |
Related Commands: Build AI Animation Story Creation App
Full CLI command usage and parameters are built intoSKILL.mdCore Workflow andscripts/scripts. The following is a quick reference index.
Command Quick Reference
| Phase | Command/Script | Location |
|---|---|---|
| Create Bailian API Key | source scripts/create-api-key.sh | SKILL.md Step 1 |
| RAM policy attachment | bash scripts/attach-policies.sh | SKILL.md RAM Policy |
| Enable OSS | aliyun ossadmin open-oss-service | SKILL.md Step 2 |
| Create OSS Bucket | aliyun oss mb | SKILL.md Step 2 |
| Create Devs project | aliyun devs create-project | SKILL.md Step 3 |
| Get UID + check role | source scripts/setup-role.sh | SKILL.md Step 4 |
| Render template + update env | bash scripts/render-and-update.sh | SKILL.md Step 4a |
| Trigger deployment | bash scripts/deploy-environment.sh | SKILL.md Step 4b |
| Poll deployment status | bash scripts/poll-deploy-status.sh | SKILL.md Step 5 |
| Create custom domain | bash scripts/create-custom-domain.sh | SKILL.md Step 6 |
| Clean up resources | aliyun fc delete-custom-domain / aliyun devs delete-project / aliyun oss rm | SKILL.md Cleanup |
Template Parameters (parameters for create-project)
| Parameter Key | Description | Value |
|---|---|---|
region | Deployment region | Fixed cn-hangzhou |
bailian_api_key | Bailian API Key | Auto-created via aliyun modelstudio create-api-key in Step 1 |
ossBucket | OSS Bucket name | Bucket created in Step 2 |
Template Variables (shared parameters for render-services-by-template)
| Variable Key | Description | Value |
|---|---|---|
namespace | Function name prefix | Set to <ProjectName> |
region | Deployment region | Fixed cn-hangzhou |
ossBucket | OSS Bucket name | Bucket created in Step 2 |
bailian_api_key | Bailian API Key | Auto-created via aliyun modelstudio create-api-key in Step 1 |
fc_role_arn | FC function execution role | acs:ram::<UID>:role/aliyundevscustomrole |
Cannot-via-CLI/SDK
| Operation | Reason | Workaround |
|---|---|---|
| First-time cloud service activation (FC) | No CLI/API support | Users activate manually in FC console |
OSS service can be auto-activated via aliyun ossadmin open-oss-service (already built into SKILL.md Step 2).Bailian workspace is auto-created via aliyun modelstudio create-workspace if none exists (built into SKILL.md Step 1).Notes
- The OSS CLI plugin does not support the
--user-agentflag (returnsinvalid flag) — use--ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deployinstead - All other
aliyuncommands must include--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
Verification Method: Build AI Animation Story Creation App
Step-by-Step Verification
1. Verify OSS Bucket Created
aliyun oss stat oss://<OSS_BUCKET_NAME> --ua AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deployExpected: Returns Bucket details (Name, Location, CreationDate, etc.)
2. Verify Project Created
aliyun devs list-environments --project-name <ProjectName> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deployExpected: Returns environment list containing at least one production environment
3. Verify Deployment Complete
aliyun devs get-environment --project-name <ProjectName> --name production --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deployExpected: status.servicesInstances.comfyui.latestDeployment.phase and status.servicesInstances.web.latestDeployment.phase are both "Finished"
4. Verify Custom Domain Created
aliyun fc get-custom-domain --domain-name <ProjectName>-web.fcv3.<UID>.cn-hangzhou.fc.devsapp.net --region cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deployExpected: Returns domain details with routeConfig containing <ProjectName>-web function route
5. Verify Application Accessible
curl -s --connect-timeout 10 --max-time 30 -o /dev/null -w "%{http_code}" http://<ProjectName>-web.fcv3.<UID>.cn-hangzhou.fc.devsapp.net/Expected: HTTP 200
#!/bin/bash
set -euo pipefail
# RAM Policy: Auto-detect identity type and attach required policies
# No env vars needed — identity info is fetched automatically
POLICIES="AliyunOSSFullAccess AliyunFCFullAccess"
IDENTITY=$(aliyun sts get-caller-identity --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1)
IDENTITY_TYPE=$(echo "$IDENTITY" | python3 -c "import sys,json; print(json.load(sys.stdin)['IdentityType'])")
if [ "$IDENTITY_TYPE" = "RAMUser" ]; then
RAM_USER=$(echo "$IDENTITY" | python3 -c "import sys,json; print(json.load(sys.stdin)['Arn'].split('/')[-1])")
echo "RAM user: $RAM_USER, auto-attaching required policies..."
for POLICY in $POLICIES; do
aliyun ram attach-policy-to-user --policy-type System --policy-name "$POLICY" --user-name "$RAM_USER" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1 | grep -v '"RequestId"' || true
done
echo "Policies attached."
else
echo "Root account detected, skipping policy attachment."
fi
#!/bin/bash
set -euo pipefail
# Step 1: Auto-create Bailian API Key
# Check workspace → Create if missing → Create API Key → Export API_KEY variable
# Use `source` to ensure API_KEY is exported to the current shell
DESCRIPTION="AI Animation Story Creation App"
# Get workspace list
WORKSPACE_RESULT=$(aliyun modelstudio list-workspaces --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null)
WORKSPACE_COUNT=$(echo "$WORKSPACE_RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('totalCount', 0))")
# If no workspace exists, create one automatically
if [ "$WORKSPACE_COUNT" = "0" ]; then
echo "No Bailian workspace found, creating one..."
CREATE_WS_RESULT=$(aliyun modelstudio create-workspace \
--workspace-name "default" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1)
WORKSPACE_ID=$(echo "$CREATE_WS_RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin)['workspace']['workspaceId'])")
echo "Workspace created: $WORKSPACE_ID"
else
WORKSPACE_ID=$(echo "$WORKSPACE_RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin)['workspaces'][0]['workspaceId'])")
echo "Workspace: $WORKSPACE_ID"
fi
# Create API Key
CREATE_RESULT=$(aliyun modelstudio create-api-key \
--workspace-id "$WORKSPACE_ID" \
--description "$DESCRIPTION" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1)
# Extract API Key value and ID
API_KEY=$(echo "$CREATE_RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin)['apiKey']['apiKeyValue'])")
API_KEY_ID=$(echo "$CREATE_RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin)['apiKey']['apiKeyId'])")
export API_KEY
export API_KEY_ID
echo "API_KEY=$API_KEY"
echo "API_KEY_ID=$API_KEY_ID"
#!/bin/bash
set -euo pipefail
# Step 6: Create custom domain
# Get token → Create helper function → Register DNS → Create FC custom domain → Clean up helper function
# Required env var: PROJECT_NAME
# Optional env var: MY_UID (auto-fetched if not set)
REGION="cn-hangzhou"
HELPER_SERVICE="serverless-devs-check"
if [ -z "${PROJECT_NAME:-}" ]; then
echo "ERROR: Environment variable PROJECT_NAME is not set" >&2
exit 1
fi
# Auto-fetch MY_UID
if [ -z "${MY_UID:-}" ]; then
MY_UID=$(aliyun sts get-caller-identity --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['AccountId'])")
export MY_UID
fi
DOMAIN_NAME="${PROJECT_NAME}-web.fcv3.${MY_UID}.${REGION}.fc.devsapp.net"
FC_FUNCTION="${PROJECT_NAME}-web"
# 6a. Get domain verification token
TOKEN=$(curl -s --connect-timeout 10 --max-time 30 -A AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy -X POST "https://domain.devsapp.net/token" \
--data-urlencode "type=fc" \
--data-urlencode "user=$MY_UID" \
--data-urlencode "region=$REGION" \
--data-urlencode "service=fcv3" \
--data-urlencode "function=$FC_FUNCTION" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['Response']['Body']['Token'])")
echo "Token: $TOKEN"
# 6b. Create helper service (ignore AlreadyExists error)
aliyun fc-open create-service --body "{\"serviceName\":\"$HELPER_SERVICE\",\"description\":\"domain check\"}" --region "$REGION" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null || true
# 6b. Create helper function
aliyun fc-open create-function --service-name "$HELPER_SERVICE" \
--body "{\"functionName\":\"domain${TOKEN}\",\"handler\":\"index.handler\",\"runtime\":\"nodejs14\",\"code\":{\"zipFile\":\"UEsDBAoAAAAIABULiFLOAhlFSQAAAE0AAAAIAAAAaW5kZXguanMdyMEJwCAMBdBVclNBskCxuxT9UGiJNgnFg8MX+o4Pc3R14/OQdkOpUFQ8mRQ2MtUujumJyv4PG6TFob3CjCEve78gtBaFkLYPUEsBAh4DCgAAAAgAFQuIUs4CGUVJAAAATQAAAAgAAAAAAAAAAAAAALSBAAAAAGluZGV4LmpzUEsFBgAAAAABAAEANgAAAG8AAAAAAA==\"},\"environmentVariables\":{\"token\":\"${TOKEN}\"},\"memorySize\":128,\"timeout\":3}" \
--region "$REGION" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# 6b. Create helper HTTP trigger
aliyun fc-open create-trigger --service-name "$HELPER_SERVICE" \
--function-name "domain${TOKEN}" \
--body '{"triggerName":"httpTrigger","triggerType":"http","triggerConfig":"{\"AuthType\":\"anonymous\",\"Methods\":[\"POST\",\"GET\"]}"}' \
--region "$REGION" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# 6c. Register devsapp.net DNS CNAME
DNS_RESULT=$(curl -s --connect-timeout 10 --max-time 30 -A AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy -X POST "https://domain.devsapp.net/domain" \
--data-urlencode "type=fc" \
--data-urlencode "user=$MY_UID" \
--data-urlencode "region=$REGION" \
--data-urlencode "service=fcv3" \
--data-urlencode "function=$FC_FUNCTION" \
--data-urlencode "token=$TOKEN")
echo "DNS registration result: $DNS_RESULT"
# Check if DNS registration succeeded
echo "$DNS_RESULT" | python3 -c "
import sys, json
try:
data = json.load(sys.stdin)
if data.get('Response', {}).get('Success') == False:
print('ERROR: DNS registration failed', file=sys.stderr)
sys.exit(1)
except (json.JSONDecodeError, KeyError):
pass
"
# 6c. Create FC custom domain
aliyun fc create-custom-domain --body "{\"domainName\":\"${DOMAIN_NAME}\",\"protocol\":\"HTTP\",\"routeConfig\":{\"routes\":[{\"functionName\":\"$FC_FUNCTION\",\"methods\":[\"GET\",\"POST\",\"PUT\",\"DELETE\",\"OPTIONS\"],\"path\":\"/*\",\"qualifier\":\"LATEST\"}]}}" --region "$REGION" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
# 6d. Clean up helper function and service
aliyun fc-open delete-trigger --service-name "$HELPER_SERVICE" --function-name "domain${TOKEN}" --trigger-name httpTrigger --region "$REGION" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null || true
aliyun fc-open delete-function --service-name "$HELPER_SERVICE" --function-name "domain${TOKEN}" --region "$REGION" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null || true
aliyun fc-open delete-service --service-name "$HELPER_SERVICE" --region "$REGION" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null || true
echo "Custom domain created: http://${DOMAIN_NAME}/"
#!/bin/bash
set -euo pipefail
# Step 4b: Trigger deployment (built-in rate-limit protection, max 3 retries, 60s interval)
# Required env var: PROJECT_NAME
ENV_NAME="production"
MAX_RETRIES=3
RETRY_INTERVAL=60
if [ -z "${PROJECT_NAME:-}" ]; then
echo "ERROR: Environment variable PROJECT_NAME is not set" >&2
exit 1
fi
for i in $(seq 1 $MAX_RETRIES); do
echo "[$(date +%H:%M:%S)] DeployEnvironment attempt ${i}/${MAX_RETRIES}..."
RESULT=$(aliyun devs deploy-environment \
--project-name "$PROJECT_NAME" \
--name "$ENV_NAME" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1) && RC=0 || RC=$?
# Check success (return code 0 and output contains valid JSON / no error)
if [ $RC -eq 0 ]; then
HTTP_CODE=$(echo "$RESULT" | python3 -c "
import sys, json
try:
data = json.load(sys.stdin)
print(data.get('HttpCode', data.get('httpCode', 200)))
except:
print(200)
" 2>/dev/null)
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "202" ]; then
echo "DeployEnvironment SUCCESS"
echo "$RESULT"
exit 0
fi
fi
# Parse error code
ERROR_CODE=$(echo "$RESULT" | python3 -c "
import sys, json
try:
data = json.load(sys.stdin)
print(data.get('Code', data.get('code', 'Unknown')))
except:
print('Unknown')
" 2>/dev/null)
echo "[$(date +%H:%M:%S)] Failed — error: $ERROR_CODE"
echo "$RESULT"
# 404 means environment does not exist, no need to retry
if echo "$RESULT" | grep -q '"HttpCode":404\|"httpCode":404\|NotFound'; then
echo "ERROR: Environment not found (404), check whether Step 3 create-project completed successfully" >&2
exit 1
fi
# No need to wait after the last attempt
if [ $i -lt $MAX_RETRIES ]; then
echo "[$(date +%H:%M:%S)] Waiting ${RETRY_INTERVAL}s before retrying..."
sleep $RETRY_INTERVAL
fi
done
echo "ERROR: DeployEnvironment failed ${MAX_RETRIES} consecutive times, stopping retries" >&2
exit 1
#!/bin/bash
set -euo pipefail
# Step 5: Poll deployment status until complete (typically 5-15 minutes)
# Required env var: PROJECT_NAME
ENV_NAME="production"
POLL_INTERVAL=30
MAX_POLLS=40
if [ -z "${PROJECT_NAME:-}" ]; then
echo "ERROR: Environment variable PROJECT_NAME is not set" >&2
exit 1
fi
echo "Waiting for deployment to finish..."
for i in $(seq 1 $MAX_POLLS); do
RESULT=$(aliyun devs get-environment --project-name "$PROJECT_NAME" --name "$ENV_NAME" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1)
COMFYUI_PHASE=$(echo "$RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('status',{}).get('servicesInstances',{}).get('comfyui',{}).get('latestDeployment',{}).get('phase','N/A'))" 2>/dev/null)
WEB_PHASE=$(echo "$RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('status',{}).get('servicesInstances',{}).get('web',{}).get('latestDeployment',{}).get('phase','N/A'))" 2>/dev/null)
echo "[$(date +%H:%M:%S)] Poll #$i: comfyui=$COMFYUI_PHASE, web=$WEB_PHASE"
if [ "$COMFYUI_PHASE" = "Finished" ] && [ "$WEB_PHASE" = "Finished" ]; then
echo "Deploy SUCCESS"
exit 0
fi
if [ "$COMFYUI_PHASE" = "Failed" ] || [ "$WEB_PHASE" = "Failed" ]; then
echo "Deploy FAILED — check error details above"
exit 1
fi
sleep $POLL_INTERVAL
done
echo "Deploy TIMEOUT — exceeded $MAX_POLLS polling attempts"
exit 1
#!/bin/bash
set -euo pipefail
# Step 4a: Render template → filter custom-domain → add roleArn → UpdateEnvironment
# Required env vars: PROJECT_NAME, BUCKET_NAME, API_KEY
# Optional env var: MY_UID (auto-fetched if not set)
REGION="cn-hangzhou"
TEMPLATE_NAME="animation-creation"
ROLE_NAME="aliyundevscustomrole"
ENV_NAME="production"
for var in PROJECT_NAME BUCKET_NAME API_KEY; do
if [ -z "${!var:-}" ]; then
echo "ERROR: Environment variable $var is not set" >&2
exit 1
fi
done
# Auto-fetch MY_UID
if [ -z "${MY_UID:-}" ]; then
MY_UID=$(aliyun sts get-caller-identity --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['AccountId'])")
export MY_UID
fi
ROLE_ARN="acs:ram::${MY_UID}:role/${ROLE_NAME}"
# Render template
RENDER_OUTPUT=$(aliyun devs render-services-by-template \
--template-name "$TEMPLATE_NAME" \
--project-name "$PROJECT_NAME" \
--variable-values "{\"shared\":{\"namespace\":\"$PROJECT_NAME\",\"region\":\"$REGION\",\"ossBucket\":\"$BUCKET_NAME\",\"bailian_api_key\":\"$API_KEY\",\"fc_role_arn\":\"$ROLE_ARN\"}}" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>&1)
# Filter custom-domain from render result and build UpdateEnvironment body
UPDATE_BODY=$(echo "$RENDER_OUTPUT" | python3 -c "
import sys,json
data = json.load(sys.stdin)
services = {k:v for k,v in data['services'].items() if k != 'custom-domain'}
body = {'name':'$ENV_NAME','spec':{'roleArn':'$ROLE_ARN','stagedConfigs':{'services':services}}}
print(json.dumps(body, ensure_ascii=False))
")
# Update environment config (must use --body, not --spec)
aliyun devs update-environment \
--project-name "$PROJECT_NAME" \
--name "$ENV_NAME" \
--body "$UPDATE_BODY" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
#!/bin/bash
set -euo pipefail
# Step 4 pre-requisite: Get UID and check/update role trust policy
# Optional env var: MY_UID (auto-fetched if not set)
REGION="cn-hangzhou"
ROLE_NAME="aliyundevscustomrole"
TRUST_POLICY='{"Statement":[{"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"Service":["devs.aliyuncs.com","fc.aliyuncs.com"]}}],"Version":"1"}'
# Auto-fetch MY_UID
if [ -z "${MY_UID:-}" ]; then
MY_UID=$(aliyun sts get-caller-identity --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['AccountId'])")
fi
export MY_UID
echo "UID: $MY_UID"
# Check if role exists; create if not
ROLE_POLICY=$(aliyun ram get-role --role-name "$ROLE_NAME" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['Role']['AssumeRolePolicyDocument'])" 2>/dev/null || echo "")
if [ -z "$ROLE_POLICY" ]; then
echo "Role $ROLE_NAME not found, creating..."
aliyun ram create-role --role-name "$ROLE_NAME" --assume-role-policy-document "$TRUST_POLICY" --description "Role for Devs and FC services" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
echo "Role created."
elif echo "$ROLE_POLICY" | grep -q "fc.aliyuncs.com"; then
echo "Role trust policy already includes fc.aliyuncs.com, skipping update"
else
echo "Updating role trust policy to include fc.aliyuncs.com..."
aliyun ram update-role --role-name "$ROLE_NAME" --new-assume-role-policy-document "$TRUST_POLICY" --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tech-solution-animation-creation-auto-deploy
fi
Related skills
How it compares
Choose this skill for Alibaba Cloud animation plus auto-deploy; choose skywork-music-maker for generative audio loops and tracks.
FAQ
What does alibabacloud-tech-solution-animation-creation-auto-deploy produce?
alibabacloud-tech-solution-animation-creation-auto-deploy creates Alibaba Cloud tech-solution animations and auto-deploys them to hosting endpoints so sales, demos, and launch channels receive publish-ready motion assets without manual upload.
Who should use the Alibaba Cloud animation auto-deploy skill?
Developers and solutions engineers on Alibaba Cloud should use alibabacloud-tech-solution-animation-creation-auto-deploy when tech-solution stories need animated visuals published to live endpoints for customer demos or launch distribution.