1

My Jenkins Master working on Windows Server and want to run a shell script with GitBash. I want to attach the EBS volume to EC2. When I run "awscli" command in GitBash, I am getting a weird invalid parameter.

$ aws ec2 attach-volume  --device /dev/sdf --volume-id vol-0d5736e1b8be30e92  --instance-id i-036540a7e7bbf712b
An error occurred (InvalidParameterValue) when calling the AttachVolume operation: Value (C:/Program Files/Git/dev/sdf) for parameter device is invalid. C:/Program Files/Git/dev/sdf is not a valid EBS device name.

enter image description here

TylerH
  • 20,799
  • 66
  • 75
  • 101
  • that seems like window having trouble with slashes, can you try with `--device "/dev/xvda"` – Adiii Feb 03 '21 at 02:36
  • Adiii thank you for your comment, but I have tried already the same error. I also tried "\/dev\/xvda". – Rustam Sariyev Feb 03 '21 at 09:37
  • $ aws ec2 attach-volume --device /dev/sdf --volume-id vol-00817f61e233134fb --instance-id i-036540a7e7bbf712b An error occurred (InvalidParameterValue) when calling the AttachVolume operation: Value (C:/Program Files/Git/dev/sdf) for parameter device is invalid. C:/Program Files/Git/dev/sdf is not a valid EBS device name. – Rustam Sariyev Feb 03 '21 at 09:43
  • $ aws ec2 attach-volume --device \dev\sdf --volume-id vol-00817f61e233134fb --instance-id i-036540a7e7bbf712b An error occurred (InvalidParameterValue) when calling the AttachVolume operation: Value (devsdf) for parameter device is invalid. devsdf is not a valid EBS device name. – Rustam Sariyev Feb 03 '21 at 09:44
  • $ aws ec2 attach-volume --device \/dev\/sdf --volume-id vol-00817f61e233134fb --instance-id i-036540a7e7bbf712b An error occurred (InvalidParameterValue) when calling the AttachVolume operation: Value (C:/Program Files/Git/dev/sdf) for parameter device is invalid. C:/Program Files/Git/dev/sdf is not a valid EBS device name. – Rustam Sariyev Feb 03 '21 at 09:44
  • $ aws ec2 attach-volume --device "\/dev\/sdf" --volume-id vol-00817f61e233134fb --instance-id i-036540a7e7bbf712b An error occurred (InvalidParameterValue) when calling the AttachVolume operation: Value (\/dev\/sdf) for parameter device is invalid. \/dev\/sdf is not a valid EBS device name. – Rustam Sariyev Feb 03 '21 at 09:44

1 Answers1

1

Finally, I found the problem.

aws ec2 attach-volume --volume-id  vol-00817f61e233134fb --instance-id i-036540a7e7bbf712b  --device '//dev\sdf'

response

{
    "AttachTime": "2021-02-03T10:08:39.661000+00:00",
    "Device": "/dev/sdf",
    "InstanceId": "i-036540a7e7bbf712b",
    "State": "attaching",
    "VolumeId": "vol-00817f61e233134fb"
}
Adiii
  • 54,482
  • 7
  • 145
  • 148