Class Ec2Snitch

  • All Implemented Interfaces:
    IEndpointSnitch
    Direct Known Subclasses:
    Ec2MultiRegionSnitch

    public class Ec2Snitch
    extends AbstractNetworkTopologySnitch
    A snitch that assumes an EC2 region is a DC and an EC2 availability_zone is a rack. This information is available in the config for the node. Since CASSANDRA-16555, it is possible to choose version of AWS IMDS. By default, since CASSANDRA-16555, IMDSv2 is used. The version of IMDS is driven by property Ec2MetadataServiceConnector.EC2_METADATA_TYPE_PROPERTY and can be of value either 'v1' or 'v2'. It is possible to specify custom URL of IMDS by Ec2MetadataServiceConnector.EC2_METADATA_URL_PROPERTY. A user is not meant to change this under normal circumstances, it is suitable for testing only. IMDSv2 is secured by a token which needs to be fetched from IDMSv2 first, and it has to be passed in a header for the actual queries to IDMSv2. Ec2Snitch is doing this automatically. The only configuration parameter exposed to a user is Ec2MetadataServiceConnector.V2Connector.AWS_EC2_METADATA_TOKEN_TTL_SECONDS_HEADER_PROPERTY which is by default set to Ec2MetadataServiceConnector.V2Connector.MAX_TOKEN_TIME_IN_SECONDS. TTL has to be an integer from the range [30, 21600].