1. Packages
  2. Pulumi Nuage
  3. API Docs
  4. aws
  5. ContainerFunction
nuage v0.1.1 published on Friday, Mar 17, 2023 by Nuage-Studio

nuage.aws.ContainerFunction

Explore with Pulumi AI

Provides an AWS Lambda Function with additional necesary resources. It bundles several resources such as Lambda Functions, Function URLs, CloudWatch keep-warm rules, Log Group with a Retention Policy, Role to run Lambda and Write Logs. It also has a feature for schedule (cron) definitions and automated X-Ray tracing.

Example Usage

Basic Example

Coming soon!

Coming soon!

Coming soon!

Coming soon!

import pulumi_nuage as nuage

repository = nuage.aws.Repository(
    "foo",
    name="repository",
    expire_in_days=30,
)

image = nuage.aws.Image(
    "foo",
    build_args=nuage.aws.DockerBuildArgs(
        dockerfile="../api/Dockerfile",
        context="../"
    ),
    repository_url=repository.url,
)

container_function = nuage.aws.ContainerFunction("foo",
    name="lambda-function",
    description="Nuage AWS ContainerFunction resource.",
    image_uri=image.uri,
    architecture="X86_64",
    memory_size=512,
    timeout=30,
    environment={"bar":"baz"},
    keep_warm=True,
    url=True,
    log_retention_in_days=90,
    schedule_config=nuage.aws.FunctionScheduleArgs(
        schedule_expression="rate(5 minutes)"
    ),
)
Copy

Coming soon!

Custom Policy Document Example

Coming soon!

Coming soon!

Coming soon!

Coming soon!

import pulumi_nuage as nuage

policy_doc = aws.iam.get_policy_document(
    version="2012-10-17",
    statements=[
        aws.iam.GetPolicyDocumentStatementArgs(
            effect="Allow",
            actions=["s3:*"],
            resources=[
                bucket.arn
            ],
        ),
    ],
).json

container_function = nuage.aws.ContainerFunction("foo",
    name="lambda-function",
    description="Nuage AWS ContainerFunction resource.",
    image_uri=image.uri,
    architecture="X86_64",
    memory_size=512,
    timeout=30,
    environment={"bar":"baz"},
    keep_warm=True,
    url=True,
    log_retention_in_days=90,
    schedule_config=nuage.aws.FunctionScheduleArgs(
        schedule_expression="rate(5 minutes)"
    ),
    policy_document=policy_doc
)
Copy

Coming soon!

Create ContainerFunction Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ContainerFunction(name: string, args: ContainerFunctionArgs, opts?: ComponentResourceOptions);
@overload
def ContainerFunction(resource_name: str,
                      args: ContainerFunctionArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def ContainerFunction(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      image_uri: Optional[str] = None,
                      memory_size: Optional[int] = None,
                      environment: Optional[Mapping[str, str]] = None,
                      description: Optional[str] = None,
                      keep_warm: Optional[bool] = None,
                      log_retention_in_days: Optional[int] = None,
                      architecture: Optional[str] = None,
                      name: Optional[str] = None,
                      name_prefix: Optional[str] = None,
                      policy_document: Optional[str] = None,
                      schedule_config: Optional[FunctionScheduleArgs] = None,
                      timeout: Optional[int] = None,
                      url_config: Optional[FunctionUrlArgs] = None)
func NewContainerFunction(ctx *Context, name string, args ContainerFunctionArgs, opts ...ResourceOption) (*ContainerFunction, error)
public ContainerFunction(string name, ContainerFunctionArgs args, ComponentResourceOptions? opts = null)
public ContainerFunction(String name, ContainerFunctionArgs args)
public ContainerFunction(String name, ContainerFunctionArgs args, ComponentResourceOptions options)
type: nuage:aws:ContainerFunction
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ContainerFunctionArgs
The arguments to resource properties.
opts ComponentResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ContainerFunctionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ContainerFunctionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ContainerFunctionArgs
The arguments to resource properties.
opts ComponentResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ContainerFunctionArgs
The arguments to resource properties.
options ComponentResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var containerFunctionResource = new Nuage.Aws.ContainerFunction("containerFunctionResource", new()
{
    ImageUri = "string",
    MemorySize = 0,
    Environment = 
    {
        { "string", "string" },
    },
    Description = "string",
    KeepWarm = false,
    LogRetentionInDays = 0,
    Architecture = "string",
    Name = "string",
    NamePrefix = "string",
    PolicyDocument = "string",
    ScheduleConfig = new Nuage.Aws.Inputs.FunctionScheduleArgs
    {
        ScheduleExpression = "string",
        ScheduleInput = 
        {
            { "string", "string" },
        },
    },
    Timeout = 0,
    UrlConfig = new Nuage.Aws.Inputs.FunctionUrlArgs
    {
        CorsConfiguration = new Aws.Lambda.Inputs.FunctionUrlCorsArgs
        {
            AllowCredentials = false,
            AllowHeaders = new[]
            {
                "string",
            },
            AllowMethods = new[]
            {
                "string",
            },
            AllowOrigins = new[]
            {
                "string",
            },
            ExposeHeaders = new[]
            {
                "string",
            },
            MaxAge = 0,
        },
        UrlEnabled = false,
    },
});
Copy
example, err := aws.NewContainerFunction(ctx, "containerFunctionResource", &aws.ContainerFunctionArgs{
	ImageUri:   pulumi.String("string"),
	MemorySize: pulumi.Int(0),
	Environment: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Description:        pulumi.String("string"),
	KeepWarm:           pulumi.Bool(false),
	LogRetentionInDays: pulumi.Int(0),
	Architecture:       pulumi.String("string"),
	Name:               pulumi.String("string"),
	NamePrefix:         pulumi.String("string"),
	PolicyDocument:     pulumi.String("string"),
	ScheduleConfig: &aws.FunctionScheduleArgs{
		ScheduleExpression: pulumi.String("string"),
		ScheduleInput: pulumi.StringMap{
			"string": pulumi.String("string"),
		},
	},
	Timeout: pulumi.Int(0),
	UrlConfig: &aws.FunctionUrlArgs{
		CorsConfiguration: &lambda.FunctionUrlCorsArgs{
			AllowCredentials: pulumi.Bool(false),
			AllowHeaders: pulumi.StringArray{
				pulumi.String("string"),
			},
			AllowMethods: pulumi.StringArray{
				pulumi.String("string"),
			},
			AllowOrigins: pulumi.StringArray{
				pulumi.String("string"),
			},
			ExposeHeaders: pulumi.StringArray{
				pulumi.String("string"),
			},
			MaxAge: pulumi.Int(0),
		},
		UrlEnabled: pulumi.Bool(false),
	},
})
Copy
var containerFunctionResource = new ContainerFunction("containerFunctionResource", ContainerFunctionArgs.builder()
    .imageUri("string")
    .memorySize(0)
    .environment(Map.of("string", "string"))
    .description("string")
    .keepWarm(false)
    .logRetentionInDays(0)
    .architecture("string")
    .name("string")
    .namePrefix("string")
    .policyDocument("string")
    .scheduleConfig(FunctionScheduleArgs.builder()
        .scheduleExpression("string")
        .scheduleInput(Map.of("string", "string"))
        .build())
    .timeout(0)
    .urlConfig(FunctionUrlArgs.builder()
        .corsConfiguration(FunctionUrlCorsArgs.builder()
            .allowCredentials(false)
            .allowHeaders("string")
            .allowMethods("string")
            .allowOrigins("string")
            .exposeHeaders("string")
            .maxAge(0)
            .build())
        .urlEnabled(false)
        .build())
    .build());
Copy
container_function_resource = nuage.aws.ContainerFunction("containerFunctionResource",
    image_uri="string",
    memory_size=0,
    environment={
        "string": "string",
    },
    description="string",
    keep_warm=False,
    log_retention_in_days=0,
    architecture="string",
    name="string",
    name_prefix="string",
    policy_document="string",
    schedule_config={
        "schedule_expression": "string",
        "schedule_input": {
            "string": "string",
        },
    },
    timeout=0,
    url_config={
        "cors_configuration": {
            "allow_credentials": False,
            "allow_headers": ["string"],
            "allow_methods": ["string"],
            "allow_origins": ["string"],
            "expose_headers": ["string"],
            "max_age": 0,
        },
        "url_enabled": False,
    })
Copy
const containerFunctionResource = new nuage.aws.ContainerFunction("containerFunctionResource", {
    imageUri: "string",
    memorySize: 0,
    environment: {
        string: "string",
    },
    description: "string",
    keepWarm: false,
    logRetentionInDays: 0,
    architecture: "string",
    name: "string",
    namePrefix: "string",
    policyDocument: "string",
    scheduleConfig: {
        scheduleExpression: "string",
        scheduleInput: {
            string: "string",
        },
    },
    timeout: 0,
    urlConfig: {
        corsConfiguration: {
            allowCredentials: false,
            allowHeaders: ["string"],
            allowMethods: ["string"],
            allowOrigins: ["string"],
            exposeHeaders: ["string"],
            maxAge: 0,
        },
        urlEnabled: false,
    },
});
Copy
type: nuage:aws:ContainerFunction
properties:
    architecture: string
    description: string
    environment:
        string: string
    imageUri: string
    keepWarm: false
    logRetentionInDays: 0
    memorySize: 0
    name: string
    namePrefix: string
    policyDocument: string
    scheduleConfig:
        scheduleExpression: string
        scheduleInput:
            string: string
    timeout: 0
    urlConfig:
        corsConfiguration:
            allowCredentials: false
            allowHeaders:
                - string
            allowMethods:
                - string
            allowOrigins:
                - string
            exposeHeaders:
                - string
            maxAge: 0
        urlEnabled: false
Copy

ContainerFunction Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ContainerFunction resource accepts the following input properties:

ImageUri This property is required. string
Image uri of the docker image.
Architecture string
Architecture, either X86_64 or ARM64. Defaults to X86_64
Description string
Description of the function.
Environment Dictionary<string, string>
Environment Variables
KeepWarm bool
Keep warm by refreshing the lambda function every 5 minutes. Defaults to false
LogRetentionInDays int
Number of days for log retention to pass in cloudwatch log group. Defaults to 90
MemorySize int
Amount of memory in MB your Lambda Function can use at runtime. Defaults to 512.
Name string
Name of the resource.
NamePrefix string
Name prefix as an alternative to name and adds random suffix at the end.
PolicyDocument string
Policy Document for lambda.
ScheduleConfig FunctionSchedule
Configure the function's cloudwatch event rule schedule.
Timeout int
Amount of time your Lambda Function has to run in seconds. Defaults to 3
UrlConfig FunctionUrl
Configure lambda function url.
ImageUri This property is required. string
Image uri of the docker image.
Architecture string
Architecture, either X86_64 or ARM64. Defaults to X86_64
Description string
Description of the function.
Environment map[string]string
Environment Variables
KeepWarm bool
Keep warm by refreshing the lambda function every 5 minutes. Defaults to false
LogRetentionInDays int
Number of days for log retention to pass in cloudwatch log group. Defaults to 90
MemorySize int
Amount of memory in MB your Lambda Function can use at runtime. Defaults to 512.
Name string
Name of the resource.
NamePrefix string
Name prefix as an alternative to name and adds random suffix at the end.
PolicyDocument string
Policy Document for lambda.
ScheduleConfig FunctionScheduleArgs
Configure the function's cloudwatch event rule schedule.
Timeout int
Amount of time your Lambda Function has to run in seconds. Defaults to 3
UrlConfig FunctionUrlArgs
Configure lambda function url.
imageUri This property is required. String
Image uri of the docker image.
architecture String
Architecture, either X86_64 or ARM64. Defaults to X86_64
description String
Description of the function.
environment Map<String,String>
Environment Variables
keepWarm Boolean
Keep warm by refreshing the lambda function every 5 minutes. Defaults to false
logRetentionInDays Integer
Number of days for log retention to pass in cloudwatch log group. Defaults to 90
memorySize Integer
Amount of memory in MB your Lambda Function can use at runtime. Defaults to 512.
name String
Name of the resource.
namePrefix String
Name prefix as an alternative to name and adds random suffix at the end.
policyDocument String
Policy Document for lambda.
scheduleConfig FunctionSchedule
Configure the function's cloudwatch event rule schedule.
timeout Integer
Amount of time your Lambda Function has to run in seconds. Defaults to 3
urlConfig FunctionUrl
Configure lambda function url.
imageUri This property is required. string
Image uri of the docker image.
architecture string
Architecture, either X86_64 or ARM64. Defaults to X86_64
description string
Description of the function.
environment {[key: string]: string}
Environment Variables
keepWarm boolean
Keep warm by refreshing the lambda function every 5 minutes. Defaults to false
logRetentionInDays number
Number of days for log retention to pass in cloudwatch log group. Defaults to 90
memorySize number
Amount of memory in MB your Lambda Function can use at runtime. Defaults to 512.
name string
Name of the resource.
namePrefix string
Name prefix as an alternative to name and adds random suffix at the end.
policyDocument string
Policy Document for lambda.
scheduleConfig FunctionSchedule
Configure the function's cloudwatch event rule schedule.
timeout number
Amount of time your Lambda Function has to run in seconds. Defaults to 3
urlConfig FunctionUrl
Configure lambda function url.
image_uri This property is required. str
Image uri of the docker image.
architecture str
Architecture, either X86_64 or ARM64. Defaults to X86_64
description str
Description of the function.
environment Mapping[str, str]
Environment Variables
keep_warm bool
Keep warm by refreshing the lambda function every 5 minutes. Defaults to false
log_retention_in_days int
Number of days for log retention to pass in cloudwatch log group. Defaults to 90
memory_size int
Amount of memory in MB your Lambda Function can use at runtime. Defaults to 512.
name str
Name of the resource.
name_prefix str
Name prefix as an alternative to name and adds random suffix at the end.
policy_document str
Policy Document for lambda.
schedule_config FunctionScheduleArgs
Configure the function's cloudwatch event rule schedule.
timeout int
Amount of time your Lambda Function has to run in seconds. Defaults to 3
url_config FunctionUrlArgs
Configure lambda function url.
imageUri This property is required. String
Image uri of the docker image.
architecture String
Architecture, either X86_64 or ARM64. Defaults to X86_64
description String
Description of the function.
environment Map<String>
Environment Variables
keepWarm Boolean
Keep warm by refreshing the lambda function every 5 minutes. Defaults to false
logRetentionInDays Number
Number of days for log retention to pass in cloudwatch log group. Defaults to 90
memorySize Number
Amount of memory in MB your Lambda Function can use at runtime. Defaults to 512.
name String
Name of the resource.
namePrefix String
Name prefix as an alternative to name and adds random suffix at the end.
policyDocument String
Policy Document for lambda.
scheduleConfig Property Map
Configure the function's cloudwatch event rule schedule.
timeout Number
Amount of time your Lambda Function has to run in seconds. Defaults to 3
urlConfig Property Map
Configure lambda function url.

Outputs

All input properties are implicitly available as output properties. Additionally, the ContainerFunction resource produces the following output properties:

Arn string
ARN (Amazon Resource Name) of the Lambda Function.
Url string
Lambda Function URL (Only valid if urlEnabled is used).
Arn string
ARN (Amazon Resource Name) of the Lambda Function.
Url string
Lambda Function URL (Only valid if urlEnabled is used).
arn String
ARN (Amazon Resource Name) of the Lambda Function.
url String
Lambda Function URL (Only valid if urlEnabled is used).
arn string
ARN (Amazon Resource Name) of the Lambda Function.
url string
Lambda Function URL (Only valid if urlEnabled is used).
arn str
ARN (Amazon Resource Name) of the Lambda Function.
url str
Lambda Function URL (Only valid if urlEnabled is used).
arn String
ARN (Amazon Resource Name) of the Lambda Function.
url String
Lambda Function URL (Only valid if urlEnabled is used).

Supporting Types

FunctionSchedule
, FunctionScheduleArgs

ScheduleExpression This property is required. string
Expression for creating a cloudwatch event rule.
ScheduleInput Dictionary<string, string>
Input for cloudwatch event target.
ScheduleExpression This property is required. string
Expression for creating a cloudwatch event rule.
ScheduleInput map[string]string
Input for cloudwatch event target.
scheduleExpression This property is required. String
Expression for creating a cloudwatch event rule.
scheduleInput Map<String,String>
Input for cloudwatch event target.
scheduleExpression This property is required. string
Expression for creating a cloudwatch event rule.
scheduleInput {[key: string]: string}
Input for cloudwatch event target.
schedule_expression This property is required. str
Expression for creating a cloudwatch event rule.
schedule_input Mapping[str, str]
Input for cloudwatch event target.
scheduleExpression This property is required. String
Expression for creating a cloudwatch event rule.
scheduleInput Map<String>
Input for cloudwatch event target.

FunctionUrl
, FunctionUrlArgs

CorsConfiguration Pulumi.Aws.Lambda.Inputs.FunctionUrlCors
CORS Configuration. This type is defined in the AWS Classic package.
UrlEnabled bool
Use Lambda URL. Defaults to false
CorsConfiguration FunctionUrlCors
CORS Configuration. This type is defined in the AWS Classic package.
UrlEnabled bool
Use Lambda URL. Defaults to false
corsConfiguration FunctionUrlCors
CORS Configuration. This type is defined in the AWS Classic package.
urlEnabled Boolean
Use Lambda URL. Defaults to false
corsConfiguration pulumiAws.types.input.lambda.FunctionUrlCors
CORS Configuration. This type is defined in the AWS Classic package.
urlEnabled boolean
Use Lambda URL. Defaults to false
cors_configuration pulumi_aws.lambda_.FunctionUrlCorsArgs
CORS Configuration. This type is defined in the AWS Classic package.
url_enabled bool
Use Lambda URL. Defaults to false
corsConfiguration Property Map
CORS Configuration. This type is defined in the AWS Classic package.
urlEnabled Boolean
Use Lambda URL. Defaults to false

Package Details

Repository
nuage
License
Apache-2.0