You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建定时备份AMI的SSM文档时遇aws:createImage插件未知错误

解决SSM自动化文档报错"Unknown plugin name: aws:createImage"的问题

最可能的原因:文档类型错误

AWS SSM文档分为Automation、Command、Policy等多种类型,aws:createImage是仅适用于Automation类型文档的插件。如果创建自定义文档时选择了Command或其他非Automation类型,就会触发该错误。

修复步骤:

  • 控制台创建:在"Document type"下拉菜单中选择Automation
  • CLI创建:指定--document-type Automation参数,示例命令:
    aws ssm create-document --content file://your-document.json --name "Weekly-AMI-Backup" --document-type Automation --schema-version "2.2"
    

其他潜在问题及修复

1. 参数引用格式错误

你的NoReboot参数为Boolean类型,在inputs中无需用引号包裹,直接传入参数引用即可(JSON会自动解析为布尔值),修正后的inputs片段:

"inputs": {
  "InstanceId": "{{ InstanceId }}",
  "ImageName": "VoIP-Weekly-Backup-AMI-{{ 'now' | date('YYYYMMdd-HHmmss') }}",
  "NoReboot": {{ NoReboot }}
}

2. JSON语法问题

检查JSON是否存在语法错误(如遗漏逗号、引号不匹配),可通过在线JSON校验工具验证格式正确性。

3. Schema版本兼容性

若所在AWS区域存在版本兼容问题,可尝试将根节点的schemaVersion改为0.3(旧版但稳定的自动化文档版本)。

修正后的完整文档

{
  "description": "Creates an AMI image from an EC2 instance",
  "schemaVersion": "2.2",
  "assumeRole": "{{ AutomationAssumeRole }}",
  "parameters": {
    "InstanceId": {
      "type": "String",
      "description": "(Required) The ID of the Amazon EC2 instance."
    },
    "NoReboot": {
      "type": "Boolean",
      "description": "(Optional) Do not reboot the instance before creating the image.",
      "default": true
    },
    "AutomationAssumeRole": {
      "type": "String",
      "description": "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf. ",
      "default": ""
    }
  },
  "mainSteps": [
    {
      "name": "createImage",
      "action": "aws:createImage",
      "onFailure": "Abort",
      "inputs": {
        "InstanceId": "{{ InstanceId }}",
        "ImageName": "VoIP-Weekly-Backup-AMI-{{ 'now' | date('YYYYMMdd-HHmmss') }}",
        "NoReboot": {{ NoReboot }}
      }
    }
  ],
  "outputs": [
    "createImage.ImageId"
  ]
}

内容的提问来源于stack exchange,提问作者Corey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 09:42:46