JavaScript SDK - Prefix list version required to modify entry despite not being a required parameter

0

According to the JavaScript aws-sdk documentation, the version number of a managed prefix list is not a required parameter when modifying an entry.

However, when I attempt to do so, I hit a MissingParameter: A prefix list version is required error.

If I set the CurrentVersion parameter to the version of the prefix list, I am able to update the entry. However, this information is not provided when calling describeManagedPrefixLists so I have to manually locate the version number in the console and update my code for it to work.

Is there a way to locate the current version number programmatically, or get past the prefix list version being a required field?

const modifyEntryParams = {
  PrefixListId: currentPrefixListID,
  CurrentVersion: 289,
  AddEntries: [{
    Cidr: currentIP,
    Description: name
  }]
}
ec2.modifyManagedPrefixList(modifyEntryParams, function(err, data) {
  if (err) console.log(err, err.stack);
  else     console.log("modify success",data);
});
質問済み 2年前377ビュー
1回答
0
承認された回答

When calling describeManagedPrefixLists the current version is returned in the field Version of the response. See sample output below:

{
  PrefixLists: [
    {
      PrefixListId: 'pl-0df3d7438f3xxxxxx',
      AddressFamily: 'IPv4',
      State: 'modify-complete',
      PrefixListArn: 'arn:aws:ec2:eu-west-1:123456789012:prefix-list/pl-0df3d7438f3xxxxxx',
      PrefixListName: 'my-list',
      MaxEntries: 100,
      Version: 2,
      Tags: [],
      OwnerId: '123456789012'
    }
  ]
}
AWS
エキスパート
回答済み 2年前
  • Ah, I was just looking in the wrong place. Lists that don't have version return nothing instead of Version: 0. Thanks for the help. Do you know why the version number is required in the first place?

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

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

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

関連するコンテンツ