- Newest
- Most votes
- Most comments
Hello Adrian, thank you for your question about VM import and the SSM agent. I understand you're looking for a way to create AMIs from imported VMs without the SSM agent pre-installed. Let's explore this issue and potential solutions.
First off, the behavior you're describing, where the SSM agent is automatically installed on imported VMs, is not typical for the VM Import/Export process. By default, VM Import/Export should not modify the contents of your VM beyond what's necessary to make it bootable on EC2.
Here are some possible explanations and solutions:
SSM Agent Pre-installation: It's possible that the SSM agent is already present in your source OVA files. Double-check your OVA creation process to ensure you're not inadvertently including the SSM agent.
AMI Configuration: After import, if you're creating an AMI from the imported instance, check if you're accidentally selecting an option to install the SSM agent.
Launch Template or Auto Scaling Group: If you're using a launch template or an Auto Scaling group to create instances from your AMI, verify that these aren't configured to install the SSM agent.
User Data: Ensure that there's no user data script associated with your instance launch process that's installing the SSM agent.
To create AMIs without the SSM agent:
Pre-import cleanup: Before importing your VM, ensure the SSM agent is not present in your OVA files.
Post-import cleanup: After importing but before creating the AMI, you can connect to the instance and manually remove the SSM agent.
Custom AMI: Create a custom AMI from the cleaned-up instance.
Your approach of using user data to remove the SSM agent at instance launch is a valid workaround, but it's not ideal as it requires this step for every instance launch. It's better to address this at the AMI level.
To further investigate:
- Check your VM Import/Export IAM role permissions. Ensure it doesn't have any policies that might trigger SSM agent installation.
- Review any AWS Organizations policies or Service Control Policies (SCPs) that might be enforcing SSM agent installation.
- If possible, try importing a minimal OS image and see if the SSM agent is still present. This can help isolate whether the issue is with your OVAs or the import process.
If you've verified all these points and still face the issue, it would be advisable to contact AWS Support. They can provide more specific guidance based on your account configuration and import process.
I hope this helps provide some guidance on this topic. All the best and thank you for using AWS!
Brian
answered 2 years ago
Relevant content
asked 3 years ago
- AWS OFFICIALUpdated 8 months ago
published 3 years ago

Hi Adrian,
We have a few ideas that might help you with this issue, but we’d like to better understand the purpose behind disabling the SSM agent. Are you looking to optimize resources, handle specific security requirements, or something else? Clarifying your intent will help us provide more targeted and effective guidance. Looking forward to your response!
Best, Aaron 😊
Good morning! Yes, let me clarify this point: we are building a PoC; we want to build some amis so students can use these ec2 to access and learn how to hack them. As a capture the flag. Then our intent has two focus: we are not interested in providing users an ec2 with an ssm agent, that could confuse them from the main purpose, the main path to hack it. Secondly, as they are going to hack the machine and be root, we are also concerned with the security implications for that. I suppose for that reason is it better too to install the ssm agent, right?
For that same security reason we are planning to block 169.254.169.254 with a nacl in that private subnet. I hope that clarifies our intent :) thanks for the question!