Repository navigation
Description
Description
Hello. I am relatively new to saltstack and salt-cloud.
I am trying to use salt-cloud function register_image
https://docs.saltproject.io/en/latest/ref/clouds/all/salt.cloud.clouds.ec2.html#salt.cloud.clouds.ec2.register_image
Current documentation has one CLI example but you can't see what parameters can be passed to this function.
While CLI example works fine, it creates AMI with one block device. So I was trying to create AMI with 2 block devices, and that option is not documented. But it exists. I've looked into source code (ec2.py) and there's argument block_device_mapping.
Now, I do not know what to pass as block_device_mapping.
I've played around a bit and added this line:
block_device_mapping = {'DeviceName': '/dev/xvda','Ebs': {'SnapshotId': 'snap-111111111','VolumeType': 'gp2'}}, {'DeviceName': '/dev/sdb','Ebs': {'SnapshotId': 'snap-222222222','VolumeType': 'gp2'}}
just before
params.update(_param_from_config('BlockDeviceMapping', block_device_mapping))
And with this I was able to create AMI with 2 block devices.
Now, the issue here is that I can't pass this in CLI:
salt-cloud -f register_image my-ec2-config ami_name=new_AMI description="new ami" architecture=x86_64 root_device_name=/dev/xvda block_device_mapping={'DeviceName': '/dev/xvda','Ebs': {'SnapshotId': 'snap-111111111','VolumeType': 'gp2'}}, {'DeviceName': '/dev/sdb','Ebs': {'SnapshotId': 'snap-222222222','VolumeType': 'gp2'}}
I've tried with double/single quotes but thad didn't work as python didn't interpret this correctly.
Does anybody know why to pass block_device_mapping to salt-cloud -f register_image ?
Suggested Fix
List of parameters that can be passed to function with examples how to use them.
Type of documentation
- Salt documentation
- Salt modules
- Man pages (which get autogenerated from the docs, such as salt.1 and salt.7)
Location or format of documentation
https://docs.saltproject.io/en/latest/ref/clouds/all/salt.cloud.clouds.ec2.html#salt.cloud.clouds.ec2.register_image
Additional context
Add any other context or screenshots about the feature request here.
Activity
welcome commentedon Aug 5, 2021
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!
bryceml commentedon Aug 10, 2021
salt/salt/cloud/clouds/ec2.py
Lines 4074 to 4154 in 76e5088
is the code. You are right, the documentation is poor there.
looks like you might be missing the
[]'s around block_device_mappings on the cli. Let me know if that fixes it.something like
garethgreenaway commentedon Aug 24, 2021
@vladaurosh Following up on this one, did the solution mentioned above resolve the issue for you? Thanks!
vladaurosh commentedon Aug 25, 2021
Hello @bryceml @garethgreenaway
Sorry for late reply.
I've tried what bryceml suggested but it didn't work:
[ERROR ] AWS Response Status Code and Error: [400 400 Client Error: Bad Request for url: https://ec2.eu-west-1.amazonaws.com/?Action=RegisterImage&Architecture=x86_64....]
{'Errors': {'Error': {'Code': 'InvalidRequest', 'Message': 'The request received was invalid.'}}, 'RequestID': '...........'}
[ERROR ] There was an error running the function: 'str' object has no attribute 'items'
dwoz commentedon Oct 15, 2026
Thanks for the original report. This issue has been open for more than three years without recent activity and carries a severity label below
severity-high. As part of a backlog cleanup, we're closing older low- and medium-severity issues so triage can focus on reports against currently supported releases.Closing isn't a judgement that the problem wasn't real — only that the codebase has moved through several releases since this was filed, and much of the surrounding code has changed.
If you — or anyone else — can still reproduce this on the 3008.x LTS release, please leave a comment with a reproduction and a maintainer will reopen. The original reporter can also reopen directly.
dwoz commentedon Oct 17, 2026
Reopening — there is an open PR tracking a fix for this: #69558.
dwoz commentedon Oct 28, 2026
Closing — consolidated into #70585. The checkbox for this item is in the appropriate theme section of that tracker. Please pick up the sub-item there.