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);
});
asked 2 years ago368 views
1 Answer
0
Accepted Answer

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
EXPERT
answered 2 years ago
  • 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?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions