title: Aws lambda , dynamodb error after deolayment : UnknownEndpoint: Inaccessible host at port `8008'. This service may not be available in the `eu-west-1'
body: <p>I am testing a fass (function as  a service ) using AWS lambda</p>
  <p>I am getting  following error on testing the api after serverless deploy</p>
  <blockquote>
  <p>query-error: UnknownEndpoint: Inaccessible host: 'localhost' at port `8008'. This service may not be available in the 'eu-west-1' region.&quot;,&quot;status&quot;:&quot;error&quot;}&quot;</p>
  </blockquote>
  <p>but when running in the local using serverless offline everything works as expected</p>
  <p>what could be the reason for this error?</p>
  <p>also in the server validation error works if wrong params are passed, this error shows up when query is being executed</p>
  <p><strong>serveless.ts</strong></p>
  <pre><code>/* eslint no-use-before-define: 0 */
  
  import type { AWS } from &quot;@serverless/typescript&quot;;
  
  // DynamoDB
  import dynamoDbTables from &quot;./resources/dynamodb-tables&quot;;
  
  // Functions
  import functions from &quot;./resources/functions&quot;;
  
  const serverlessConfiguration: AWS = {
    service: &quot;lead-management-app&quot;,
    frameworkVersion: &quot;2&quot;,
    custom: {
      region: &quot;${opt:region, self:provider.region}&quot;,
      stage: &quot;${opt:stage, self:provider.stage}&quot;,
      prefix: &quot;${self:service}-${self:custom.stage}&quot;,
      lead_table: &quot;${self:service}-leads-${opt:stage, self:provider.stage}&quot;,
      interest_table:
        &quot;${self:service}-interests-${opt:stage, self:provider.stage}&quot;,
      table_throughputs: {
        prod: 5,
        default: 1,
      },
      table_throughput:
        &quot;${self:custom.table_throughputs.${self:custom.stage}, self:custom.table_throughputs.default}&quot;,
      dynamodb: {
        stages: [&quot;dev&quot;],
        start: {
          port: 8008,
          inMemory: true,
          heapInitial: &quot;200m&quot;,
          heapMax: &quot;1g&quot;,
          migrate: true,
          seed: true,
          convertEmptyValues: true,
          // Uncomment only if you already have a DynamoDB running locally
          // noStart: true
        },
      },
      [&quot;serverless-offline&quot;]: {
        httpPort: 3000,
        babelOptions: {
          presets: [&quot;env&quot;],
        },
      },
      profile: {
        prod: &quot;prodAccount&quot;,
        dev: &quot;devAccount&quot;,
      },
    },
    plugins: [
      &quot;serverless-bundle&quot;,
      &quot;serverless-dynamodb-local&quot;,
      &quot;serverless-offline&quot;,
      &quot;serverless-dotenv-plugin&quot;,
    ],
    provider: {
      name: &quot;aws&quot;,
      runtime: &quot;nodejs14.x&quot;,
      stage: &quot;dev&quot;,
      region: &quot;eu-west-1&quot;,
      apiGateway: {
        minimumCompressionSize: 1024,
        shouldStartNameWithService: true,
      },
      environment: {
        AWS_NODEJS_CONNECTION_REUSE_ENABLED: &quot;1&quot;,
        NODE_OPTIONS: &quot;--enable-source-maps --stack-trace-limit=1000&quot;,
        REGION: &quot;${self:custom.region}&quot;,
        STAGE: &quot;${self:custom.stage}&quot;,
        LEADS_TABLE: &quot;${self:custom.lead_table}&quot;,
        INTERESTS_TABLE: &quot;${self:custom.interest_table}&quot;,
      },
      iamRoleStatements: [
        {
          Effect: &quot;Allow&quot;,
          Action: [
            &quot;dynamodb:DescribeTable&quot;,
            &quot;dynamodb:Query&quot;,
            &quot;dynamodb:Scan&quot;,
            &quot;dynamodb:GetItem&quot;,
            &quot;dynamodb:PutItem&quot;,
            &quot;dynamodb:UpdateItem&quot;,
            &quot;dynamodb:DeleteItem&quot;,
          ],
          Resource: [
            { &quot;Fn::GetAtt&quot;: [&quot;LeadsTable&quot;, &quot;Arn&quot;] },
            { &quot;Fn::GetAtt&quot;: [&quot;InterestsTable&quot;, &quot;Arn&quot;] },
          ],
        },
      ],
      profile: &quot;${self:custom.profile.${self:custom.stage}}&quot;,
      lambdaHashingVersion: &quot;20201221&quot;,
    },
    // import the function via paths
    functions,
    package: { individually: true },
    resources: {
      Resources: dynamoDbTables,
    },
  };
  
  module.exports = serverlessConfiguration;
  </code></pre>