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

EC2Launch v2下WS2022多硬盘自动初始化技术求助

迁移困惑

我不确定AWS期望工程师如何从EC2Launch v1迁移到EC2Launch v2……长期来看这或许是解决方案,但目前我还没搞明白。我很难找到与EC2Launch v2交互的实用文档,暂时先放弃这条路径。

背景

我正尝试用CloudFormation脚本启动一台带多块硬盘的WS2022服务器,希望通过AWS::SSM::Document资源实现硬盘初始化自动化。

问题

WS2022服务器启动后,必须手动通过磁盘管理器初始化额外的硬盘。

期望结果

服务器启动后即可直接使用多块硬盘。

已尝试操作

  • 尝试通过图形界面AWS EC2 Launch初始化硬盘,但未成功;
  • 正在改写EC2Launch v1的InitializeDisk.ps1脚本,计划后续上传至S3存储桶并通过SSMDocument执行。

CloudFormation模板代码

# Don't worry about the Ref Variables as they are pretty generic. 

# Create Instance
WindowsServer2022Instance:
  Type: 'AWS::EC2::Instance'
  Properties:
    InstanceType: 'i3.large'
    ImageId:  # WS2022 AMI Image
    IamInstanceProfile: # Some InstanceProfile 
    EbsOptimized: true
    KeyName: 
      Ref: # Some KeyName
    NetworkInterfaces:
      - DeviceIndex: '0'
        SubnetId: # Some Subnet ID
        AssociatePublicIpAddress: true
        GroupSet:
          - Ref: # Some Security Group ID
        
# EC2 Volume Creation
AdditionalVolume:
  Type: 'AWS::EC2::Volume'
  Properties:
    Size: 100
    AvailabilityZone:
      Fn::GetAtt:
        - 'WindowsServer2022Instance'
        - 'AvailabilityZone'
    VolumeType: 'gp3'
# Attach EC2 Volume
VolumeAttachment:
  Type: 'AWS::EC2::VolumeAttachment'
  Properties:
    InstanceId:
      Ref: 'WindowsServer2022Instance'
    VolumeId:
      Ref: 'AdditionalVolume'
    Device: '/dev/sdf'

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.01 10:42:49