aws / aws/aws-extensions-for-dotnet-cli
donet8 AOT: cannot dyamically set lambda architecture from cloud formation parameter
- Dominant language
- C#
- Stars
- 393
- Forks
- 90
- Avg merge
- 2d 19m
- Merged PRs (30d)
- 3
Description
### Describe the bug
In my cloudformation json template I have the following parameter in my parameter list:
```
"LambdaArchitecture": {
"Type": "String",
"Default": "arm64",
"AllowedValues": ["x86_64", "arm64"],
"Description": "Architecture for lambda functions."
}
```
And in my `AWS::Serverless::Function` definitions I set the architecture by referencing this parameter:
```
"Architectures": [
{
"Ref": "LambdaArchitecture"
}
]
```
While trying to deploy on my Macbook using `dotnet lambda deploy-serverless` I get the following error:
"Host machine architecture (Arm64) differs from Lambda architecture (X64). Building Native AOT Lambda functions require the host and lambda architectures to match."
If I hard code the architecture to `arm64` I don't get this error.
```
"Architectures": ["arm64"]
```
### Expected Behavior
The architecture should be set based on the `LambdaArchitecture` parameter.
### Current Behavior
I get an error telling me that the target architecture is set to x86_64 even though I am setting it to arm64 via a cloud formation parameter.
### Reproduction Steps
See description
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### AWS .NET SDK and/or Package version used
Amazon Lambda Tools for .NET Core applications (5.10.1)
### Targeted .NET Platform
.NET 8
### Operating System and version
MacOS Monterey
Contributor guide
Research direction
Reproduce the .NET 8 Native AOT deployment on macOS with the shown CloudFormation template and dotnet lambda deploy-serverless. Trace how the tool resolves Architectures when it receives a Ref versus a literal value; done means the arm64 parameter is honored and deployment no longer reports an x86_64 mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, csharp
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100