Summary:
This is the first major release of the amazon-ec2-metadata-mock tool.
amazon-ec2-metadata-mock is a tool to simulate Amazon EC2 instance metadata service for local testing.
Why did we build this?
The instance metadata service is accessed from an Amazon EC2 instance, and it vends metadata about the instance such as hostname, instance-id, maintenance events, spot actions, etc.
However, some instance metadata is available only when an instance is affected by an event OR if configured a specific way. E.g. A Spot instance's metadata item spot/instance-action
is available only when AWS decides to interrupt the Spot instance. E.g. Metadata for an EBS volume block-device-mapping/ebsN
is only available if the instance was configured to have a volume at launch time.
Because of this, it it challenging to test one's application for how it will respond in the event of a Spot interruption or other such events and requiring an EC2 instance for testing. ec2-metadata-mock attempts to bridge these gaps by providing mocks for most of these metadata categories. The mock responses are designed to replicate those from the actual instance metadata service for accurate, local testing.
Major Features
- Emulate Spot Instance Interruption (ITN) events
- Delay mock response from the mock serve start time
- Configure metadata in mock responses via CLI flags, config file, env variables
- IMDSv1 and v2 support (configurable for IMDSv2 support only)
- Save processed configuration to a local file