Skip to main content

@aws-cdk/aws-lambda-dotnet

Project description

AWS Lambda .NET Library

---

cdk-constructs: Experimental

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


This library provides constructs for .NET Lambda functions.

To use this module you will either need to have .NET SDK installed (.NET 6.0 or later) with the AWS Lambda Tools for .NET or Docker installed.

.NET Function

Define a DotNetFunction:

dotnet.DotNetFunction(self, "MyFunction",
    project_dir="src/MyFunction"
)

All other properties of lambda.Function are supported, see also the AWS Lambda construct library.

Custom Runtime and Native AOT

With this construct it is possible to use a custom runtime by setting the runtime to PROVIDED_AL2. This allows you to run unsupported .NET runtime versions like .NET 7.0 or Native AOT. Setting the runtime to PROVIDED_AL2 will instruct CDK and the AWS Lambda Tools for .NET to build your project in a Docker container based of Amazon Linux 2. An example can be found below.

dotnet.DotNetFunction(self, "MyFunction",
    project_dir="src/MyFunction",
    runtime=lambda_.Runtime.PROVIDED_AL2,
    bundling=dotnet.BundlingOptions(
        msbuild_parameters=["/p:PublishAot=true"]
    )
)

Make sure <AssemblyName>bootstrap</AssemblyName> is set in the csproj file as this is required by the custom runtime.

Publishing your application with Native AOT requires you to use the same processor architecture for the Lambda function as for your build environment. Without specification, the construct automatically selects the processor architecture of the machine where CDK is building your project.

Community Extensions

We encourage the development of Community Service Extensions that support advanced features. Here are some useful extensions that we have reviewed:

Please submit a pull request so that we can review your service extension and list it here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_cdk_aws_lambda_dotnet-0.0.5.tar.gz (77.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file aws_cdk_aws_lambda_dotnet-0.0.5.tar.gz.

File metadata

File hashes

Hashes for aws_cdk_aws_lambda_dotnet-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a1e2fdf4860d092760007297a3aa3fa6fbce2f91429706b4a785b91a04cfc877
MD5 e8faf818482857e26439a37256464105
BLAKE2b-256 94c7572f3c1d95f42ea5e287f6bc918fea326eb44dcc1564a6cbf77093bbefb9

See more details on using hashes here.

File details

Details for the file aws_cdk.aws_lambda_dotnet-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_cdk.aws_lambda_dotnet-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 85123297ceb7b476fae0109b48be07e67e5227ef1737cef59989c1379871d352
MD5 a897d581b494ddfa32aeda06bba883f8
BLAKE2b-256 491a47b308cea0278d7efd8da4fbaa2966b100bf37d172f00cb2419c94a6b878

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page