aws / aws-dotnet-deploy

Opinionated tooling that simplifies deployment of .NET applications to AWS.
https://aws.github.io/aws-dotnet-deploy/
Apache License 2.0
140 stars 32 forks source link

Add support for .NET 9 and support for disabling IMDS v1 #878

Closed normj closed 1 month ago

normj commented 1 month ago

Issue #, if available: https://github.com/aws/aws-dotnet-deploy/issues/877

Description of changes: EC2 made a change that new accounts created after Oct 1 2024. This means today if an account created after Oct 1st tries to deploy to Beanstalk using our tooling it will fail because it can't create a LaunchConfiguration.

To force Beanstalk you need to set one of the following 4 settings.

None of these setting are currently settable in the tooling. Ideally we should add support for now I added DisableIMDSv1. The other settings require more settings to be set when enabled and there isn't an obvious default.

The DisableIMDSv1 is a boolean property but we have to be careful not to automatically set this to true on existing environments when users do a redeployment. That could break environments. The compromise I did was modeled the property as 3 state value: Enabled, Disabled and Default.

The Default value is the the default for the new setting in the recipe. Using Default means in the CDK project to set DisableIMDSv1 for new deployments but for redeployments leave the setting alone. That way existing users when they upgrade to the new version of the tooling no change will be made to their environments when they redeploy. This required adding metadata being passed into the CDK project whether it was being run for a new deployment or not.

I decided to make the changes to add .NET 9 support while I was waiting for test deployments to finish. The change was just to add the .NET 9 target in the recipe rules files and update the docker manifest.

Testing

I have run all of the unit and integ tests. Before making any changes I created a new AWS account and reproduced the failure situation. After making the changes I was able to do deployments and redeployments with both my old account and new account. I also ran through .NET 9 deployments.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

philasmar commented 1 month ago

Could you also add a change file to this PR?

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 62.39%. Comparing base (bd41f9d) to head (7bf06e5). Report is 6 commits behind head on dev.

Files with missing lines Patch % Lines
...igFileDeployment/DeploymentSettingsHandlerTests.cs 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #878 +/- ## ======================================= Coverage 62.39% 62.39% ======================================= Files 279 279 Lines 10905 10908 +3 Branches 1515 1515 ======================================= + Hits 6804 6806 +2 - Misses 3564 3565 +1 Partials 537 537 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.