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);
});
preguntada hace 2 años376 visualizaciones
1 Respuesta
0
Respuesta aceptada

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
EXPERTO
respondido hace 2 años
  • 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?

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas