An error occurred (InvalidBlockDeviceMapping) when calling the RunInstances operation: Invalid device name C:/Program Files/Git/dev/sda1


I am trying to run a shellscript on my local which launches an ec2 instance .when I try to run the script this error comes up. An error occurred (InvalidBlockDeviceMapping) when calling the RunInstances operation: Invalid device name C:/Program Files/Git/dev/sda1, what should be done. the blockdevicemapping is already mapped in the script. I have awscli installed in my device, access keys configured.

asked a year ago414 views
2 Answers


the device name is obviously invalid since C:/Program Files/Git/dev/sda1 it merges two os path into a single one (windows and Linux)

Use the run-instances AWS CLI command with the --block-device-mappings option to specify a block device mapping for an instance at launch and check the block device mapping path

and update your script accordingly.

profile picture
answered a year ago
  • Hey thanks @sdtslmn for taking time for help, The output name shown here is the error message the terminal gives me, the device name that is mapped in the script is correct which meant to be /dev/sda1. I think there should be some other issue with my git configuration or something? Because the same script were successfully executed by my colleague .


Try prepending MSYS_NO_PATHCONV=1 to the beginning of your command-line. See Git for Windows: Known Issues.

answered a year ago
  • Hi @ennui Hope you are doing well. Thanks for taking time to help .This is actually a correct answer, but can you narrow down it to the exact answer what should be the permanent solution for this? I tried editing the path in script to --block-device-mappings "DeviceName=//dev\sda1 instead of --block-device-mappings "DeviceName=/dev/sda1 which originally was in the script and it worked for me. The solution you suggested is correct but I need to know what exactly I should do to avoid this error without modifying the path.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions

Relevant content