question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AWS Lambda: Support ImageConfig properties

See original GitHub issue

There is new image: option that can create AWS Lambda function based on docker container image. It would be nice to support image_config as well, to override image Command, EntryPoint and WorkingDirectory.

functions:
  hello:
    image: ${env:DOCKER_IMAGE}
   
  hello2:
    image: ${env:DOCKER_IMAGE}
    image_config:
      command: ["app.handler2"]

or even

provider:
  image: ${env:DOCKER_IMAGE}
functions:
  hello:
    image_config:
      command: ["app.handler"]
  hello2:
    image_config:
      command: ["app.handler2"]
      working_dir: "/var/task/experimental"
  hello3:
    image_config:
      command: ["app.swift_handler"]
      entry_point: 
         - /var/runtime/swift_bootstrap

Use case description

It would be possible to share one docker image and choose specific handler per lambda function. It would be event better if provider section allows to define global image, shared between all lambda functions that contain image_config parameter. Similar like it’s done for layers.

Proposed solution

At the moment you can achieve similar thing overriding LambdaFunction in Resources

service: sls-container-image-test
useDotenv: true
provider: 
  name: aws
  region: ap-northeast-1

functions:
  hello:
    image: ${env:DOCKER_IMAGE}
  hello2:
    image: ${env:DOCKER_IMAGE}

resources:
  Resources:
    Hello2LambdaFunction:
      Type: AWS::Lambda::Function
      Properties: 
        ImageConfig:
          EntryPoint: 
            - /var/runtime/bootstrap
          Command: ["app.handler2"]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
medikoocommented, Dec 8, 2020

@arekt great thanks for proposal. We’re definitely open for it, still to be more on par with current conventions I believe it should be configured in a way that we expand already defined image property, So extended configuration we could look as follows:

functions:
  hello:
    image:
      uri: 000000000000.dkr.ecr.sa-east-1.amazonaws.com/test-lambda-docker@sha256:6bb600b4d6e1d7cf521097177dd0c4e9ea373edb91984a505333be8ac9455d38
      command: ...
      workingDir: ...

What do you think?

Also what exactly properties do you believe we should support, and how will they map to generated CloudFormation template?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::Lambda::Function ImageConfig - AWS CloudFormation
Use the AWS CloudFormation AWS::Lambda::Function.ImageConfig resource for Lambda. ... Properties. Command. Specifies parameters that you want to pass in ...
Read more >
AWS::Lambda::Function ImageConfig - Amazon CloudFormation
Use the Amazon CloudFormation AWS::Lambda::Function.ImageConfig resource for Lambda. ... SyntaxProperties. Services or capabilities described in Amazon Web ...
Read more >
Container image support for AWS Lambda via cloudformation
Yes it does. AWS::Lambda::Function has new properties specific to container images, such as: ImageConfig; PackageType; ImageUri.
Read more >
aws.lambda.Function - Pulumi
Documentation for the aws.lambda.Function resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >
Let's Try Lambda Container Support with SAM CLI - hayao-k.dev
Introduction Container image support for AWS Lambda was announced at ... Properties: PackageType: Image # ImageConfig: # Uncomment this to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found