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);
});
gefragt vor 2 Jahren376 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
EXPERTE
beantwortet vor 2 Jahren
  • 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?

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen