Monday 5 June 2017

NodeJS Lambda Region WAF IPSetID

I am new NodeJS and trying to alter this sample provided by AWS for reputation list updates however it is specific to CloudFront Global Region only.

https://github.com/awslabs/aws-waf-sample/tree/master/waf-reputation-lists

I have made the changes to the CloudFormation to create regional IPSetID however the function exits on the fact the IPSetID does not exist. I assume this is due to the fact the SDK is looking at global rather than regional i.e eu-west-1 therefore I've set the region in the config but it is still unable to locate the IPSet.

var aws = require('aws-sdk');

// configure API retries
aws.config.update({
    region:'eu-west-1',
    maxRetries: 3,
    retryDelayOptions: {
        base: 1000
    }
});
var waf = new aws.WAF();

I've seen a recent question (AWS WAF update ip sets and rules specific to a region from lambda) which shows the URL differences however I do not know where to start to update the URL?

Error getting IP sets { [WAFNonexistentItemException: The referenced item does not exist.]
          message: 'The referenced item does not exist.',
          code: 'WAFNonexistentItemException',
          statusCode: 400,
          retryable: false,
          retryDelay: 162.11187234148383 }

    Error getting ranges and/or IP sets { [WAFNonexistentItemException: The referenced item does not exist.]
          message: 'The referenced item does not exist.',
          code: 'WAFNonexistentItemException',
          statusCode: 400,
          retryable: false,
          retryDelay: 162.11187234148383 }


        {
          "errorMessage": "The referenced item does not exist.",
          "errorType": "WAFNonexistentItemException",
          "stackTrace": [
            "Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:48:27)",
            "Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:105:20)",
            "Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
            "Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:682:14)",
            "Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)",
            "AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)",
            "/var/task/node_modules/aws-sdk/lib/state_machine.js:26:10",
            "Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)",
            "Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:684:12)",
            "Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:115:18)"
          ]
        }



via Sphinx's

No comments:

Post a Comment