Using Function URL and API Gateway in a single lambda

Hi there, Here I’m trying to deploy my lambda with both function URL and API Gateway to be enabled. Function URL for communication between my internal server where my ecs will invoke this lambda so I configured the function url with AWS_IAM and I need API Gateway for the public access of my lambda using an API Key. So, I configured both the configs in my serverless but after deployment the API Gateway only being created and tagged to the lambda the function URL is not creating, could someone correct my script?

service: ${self:custom.tags.service}
package:
  individually: true
  exclude:
    - "./**"
provider:
  name: aws
  region: ${self:custom.params.AWSREGION}
  stage: ${opt:stage, "test"}
  runtime: ${self:custom.params.LAMBDA_RUNTIME}
  tracing:
    lambda: true
  deploymentBucket:
    name: ${self:custom.params.DEPLOY_S3_BUCKET_NAME}
  apiGateway:
    apiKeys:
      - ${self:custom.params.API_GATEWAY_API_KEY}
custom:
  defaults: ${file(./default.yml)}
  tags: ${self:custom.defaults.custom.tags}
  params: ${self:custom.defaults.custom.params.${self:provider.stage}}
  service: ${self:custom.defaults.custom.tags.service}
  lambda:
    base:
      name: ${self:service}
    lambda1name:
      name: ${self:custom.tags.lambdaFunctionName}-${self:provider.stage}
functions:
  RegexFunction:
    name: ${self:custom.lambda.lambda1name.name}
    description: "Lambda function for ${self:custom.tags.application}"
    handler: ${self:custom.tags.handlerPath}.${self:custom.tags.handler}::handleRequest
    timeout: ${self:custom.params.LAMBDA_TIMEOUT}
    memorySize: ${self:custom.params.LAMBDA_MEMORY_SIZE}
    snapStart: ${self:custom.params.LAMBDA_SNAPSTART_STATE}
    environment:
      SPRING_PROFILES_ACTIVE: ${self:provider.stage}
    package: 
      artifact: target/${self:custom.tags.application}-${env:VERSION}-aws.jar
    events:
      - http:
          path: ${self:custom.lambda.lambda1name.name}
          method: post
          cors: true
          private: true
    url:
      authorizer: aws_iam
    vpc:
      securityGroupIds: 
      - ${self:custom.params.LAMBDA_SECURITY_GROUP_ID}
      subnetIds: 
      - ${self:custom.params.PRIVATE_SUBNET_1}
      - ${self:custom.params.PRIVATE_SUBNET_2}
      - ${self:custom.params.PRIVATE_SUBNET_3}
resources:
  Resources:
    ApiGatewayUsagePlan:
      Type: AWS::ApiGateway::UsagePlan
      Properties:
        ApiStages:
          - ApiId: !Ref ApiGatewayRestApi
            Stage: ${self:provider.stage}
        Description: Usage plan for ${self:service}
        UsagePlanName: ${self:service}-usage-plan-${self:provider.stage}
        Quota:
          Limit: 3000
          Period: MONTH
        Throttle:
          BurstLimit: 10
          RateLimit: 100

    ApiGatewayUsagePlanKey:
      Type: AWS::ApiGateway::UsagePlanKey
      Properties:
        KeyId: ${self:custom.params.API_GATEWAY_API_KEY_ID}
        KeyType: API_KEY
        UsagePlanId: !Ref ApiGatewayUsagePlan

I need both API Endpoiint as a trigger for public access and function URL needs to be invoked by my internal services which ECS.

Thanks for your support

You could just configure your internal apps to use the public API, with an API key. This would greatly simplify things, and “eating your own dog food” is gonna help down the line too.