How to check for InvalidKeyPair.Duplicate in AWS SDK Go v2

0

Hello,

I see an error when a pair is already present, I would like to check for error type correctly on Go with errors.As/Is but I am unable to find the proper type for this particular error in the SDK. It is so huge, apparently it's generated somehow. Any hint what is the correct type to check for?

Thanks!

lzap
質問済み 2年前374ビュー
1回答
0

Hi Lzap

I understand you want to check if a key pair is invalid. Please correct if my understanding is wrong.

Please ensure that the key pair name is not existing on your AWS region, If it does, create or import a key that is unique from the existing key pair names. To check if a key pair exist within your region run the following on AWS CLI "aws ec2 wait key-pair-exists
--key-names my-key-pair" [1], You can also check by displaying the key pair using fingerprint for your key pair, because it is generated from it and can be used to verify that the private key on your local machine matches the public key stored in AWS[2].

I hope the information above is helpful to resolve the issue in question.

References:

1.https://docs.aws.amazon.com/cli/latest/reference/ec2/wait/key-pair-exists.html 2.https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-keypairs.html

回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ