diff --git a/.changelog/12371.txt b/.changelog/12371.txt new file mode 100644 index 000000000000..e621c787ff24 --- /dev/null +++ b/.changelog/12371.txt @@ -0,0 +1,3 @@ +```release-note:improvement +client: fingerprint AWS instance life cycle option +``` diff --git a/client/fingerprint/env_aws.go b/client/fingerprint/env_aws.go index 95af1cf87fa6..b39317d1ac76 100644 --- a/client/fingerprint/env_aws.go +++ b/client/fingerprint/env_aws.go @@ -91,6 +91,7 @@ func (f *EnvAWSFingerprint) Fingerprint(request *FingerprintRequest, response *F "ami-id": false, "hostname": true, "instance-id": true, + "instance-life-cycle": false, "instance-type": false, "local-hostname": true, "local-ipv4": true, diff --git a/client/fingerprint/env_aws_test.go b/client/fingerprint/env_aws_test.go index caca5f4bae13..c346b788da01 100644 --- a/client/fingerprint/env_aws_test.go +++ b/client/fingerprint/env_aws_test.go @@ -52,6 +52,7 @@ func TestEnvAWSFingerprint_aws(t *testing.T) { "platform.aws.ami-id", "unique.platform.aws.hostname", "unique.platform.aws.instance-id", + "platform.aws.instance-life-cycle", "platform.aws.instance-type", "unique.platform.aws.local-hostname", "unique.platform.aws.local-ipv4", @@ -334,6 +335,11 @@ var awsStubs = []endpoint{ ContentType: "text/plain", Body: "i-b3ba3875", }, + { + Uri: "/latest/meta-data/instance-life-cycle", + ContentType: "text/plain", + Body: "on-demand", + }, { Uri: "/latest/meta-data/instance-type", ContentType: "text/plain", @@ -387,6 +393,11 @@ var unknownInstanceType = []endpoint{ ContentType: "text/plain", Body: "i-b3ba3875", }, + { + Uri: "/latest/meta-data/instance-life-cycle", + ContentType: "text/plain", + Body: "on-demand", + }, { Uri: "/latest/meta-data/instance-type", ContentType: "text/plain", @@ -417,6 +428,11 @@ var noNetworkAWSStubs = []endpoint{ ContentType: "text/plain", Body: "i-b3ba3875", }, + { + Uri: "/latest/meta-data/instance-life-cycle", + ContentType: "text/plain", + Body: "on-demand", + }, { Uri: "/latest/meta-data/instance-type", ContentType: "text/plain", diff --git a/website/content/docs/runtime/interpolation.mdx b/website/content/docs/runtime/interpolation.mdx index 31da7917f411..a1c28f1c79db 100644 --- a/website/content/docs/runtime/interpolation.mdx +++ b/website/content/docs/runtime/interpolation.mdx @@ -235,6 +235,12 @@ Below is a table documenting common node properties: AMI ID of the client (if on AWS EC2) + + + {'${attr.platform.aws.instance-life-cycle}'} + + Instance lifecycle (e.g. spot, on-demand) of the client (if on AWS EC2) + {'${attr.platform.aws.instance-type}'}