Tim Bassett
Tim Bassett

Reputation: 1178

How Do You "dotnet lambda package-ci" for arm64?

Describe the issue

We are trying to use dotnet lambda package-ci to package for arm64

dotnet lambda package --help documentation shows -farch | --function-architecture The architecture of the Lambda function. Valid values: x86_64 or arm64. Default is x86_64

Yet, dotnet lambda package-ci --help shows no switch for architecture.

We have issued:

  1. dotnet lambda package-ci ... --runtime linux-arm64
  2. dotnet lambda package-ci ... --function-architecture arm64 --msbuild-parameters "--arch linux-arm64"
  3. dotnet lambda package-ci ... --function-architecture arm64

These do not produce any arm64 results, all produce the publish command as something like dotnet publish --output "/codebuild/output/src054284391/src/bbapi/WebApi/./bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false or an error

So, how Do You "dotnet lambda package-ci" for arm64?

Links

https://github.com/aws/aws-extensions-for-dotnet-cli

Upvotes: 1

Views: 1373

Answers (1)

plantpowerjames
plantpowerjames

Reputation: 385

The architecture comes from whatever is specified in your temlate file when you specify the architecture for the AWS::Serverless::Function.

Taken from the GitHub repo:

Package CI
dotnet lambda package-ci

Used for serverless applications. It creates the Lambda application bundle and uploads it to Amazon S3. It then writes a new version of the serverless.template with the location of the Lambda function code updated to where the application bundle was uploaded. In an AWS CodePipeline this command can be executed as part of a CodeBuild stage returning the transformed template as the build artifact. Later in the pipeline that transformed serverless.template can be used with a CloudFormation stage to deploy the application.

Notes

dotnet lambda package-ci inspects and uses the Architectures property of AWS::Serverless::Function to determine the runtime of the package.

For example:

      "Architectures": [
        "arm64"
      ],

will execute dotnet publish with a --runtime argument of value linux-arm64:

Upvotes: 2

Related Questions