aws-extensions-for-dotnet-cli icon indicating copy to clipboard operation
aws-extensions-for-dotnet-cli copied to clipboard

eb dry run command (or option) to create the zip file that has everything necessary to deploy to AWS but doesn't perform deployment

Open wizofaus opened this issue 1 year ago • 4 comments

Describe the feature

Currently there's a "dotnet eb publish" command that seems to just do the equivalent of "dotnet publish", but ignores any AWS/EB-specific configuration settings. I would like the ability to create a zip file that has everything necessary to publish to AWS, then ideally show the "dry-run" steps that could use that zip file to do the deploy.

Use Case

It's not always safe to automatically deploy everything to AWS, but we want our build pipeline to do everything up to the very last point, and then just do a dry-run of the deployment.

Proposed Solution

dotnet eb deploy-environment --dry-run

Other Information

No response

Acknowledgements

  • [X] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

Targeted .NET platform

.NET 8

CLI extension version

4.4.0

Environment details (OS name and version, etc.)

Windows 11

wizofaus avatar Jul 31 '24 05:07 wizofaus

Appears to be useful feature request. Needs review with the team.

ashishdhingra avatar Jul 31 '24 22:07 ashishdhingra

It sounds like what you are asking for is a just do the package part of deployment like we do with Lambda with our dotnet lambda package command.

Most of our feature work for Beanstalk deployment is happening in our newer aws/aws-dotnet-deploy tooling. Could open a story in that repository so we can discuss how we could integrate that capability into that tooling.

normj avatar Aug 03 '24 00:08 normj

If I use that instead how do I transform the --additional-options setting? Figuring that out is what took me the most time with dotnet eb deploy-environment! (there's virtually no documentation about it, had to step through the code...). FWIW my deployment script currently looks like

  DEFAULTS=aws-beanstalk-tools-default.json
  OPT1=\"aws:elbv2:listener:443,ListenerEnabled\"=\"true\"\;
  OPT2=\"aws:elbv2:listener:443,Protocol\"=\"HTTPS\"\;
  OPT3=\"aws:elbv2:listener:443,SSLCertificateArns\"=\"${AWS_CERT_ID}\"\;
  OPT4=\"aws:autoscaling:launchconfiguration,SecurityGroups\"=\"${AWS_SECURITY_GROUP_ID}\"\;
  OPT5=\"aws:elbv2:listener:80,ListenerEnabled\"=\"false\"\;
  ADDITIONAL_OPTIONS=$(echo $OPT1$OPT2$OPT3$OPT4$OPT5 | jq -aR .)
  echo '{' > ${DEFAULTS}
  echo  \"application\": \"${AWS_APPLICATION_NAME}\", >> ${DEFAULTS}
  echo  \"environment\": \"${AWS_ENVIRONMENT_NAME:-${AWS_APPLICATION_NAME}-env}\", >> ${DEFAULTS}
  echo  \"solution-stack\": \"64bit Amazon Linux 2023 v3.1.3 running .NET 8\", >> ${DEFAULTS}
  echo  \"instance-profile\": \"aws-elasticbeanstalk-ec2-role\", >> ${DEFAULTS}
  echo  \"health-check-url\" : \"/swagger/index.html\", >> ${DEFAULTS}
  echo  \"environment-type\" : \"LoadBalanced\", >> ${DEFAULTS}
  echo  \"additional-options\": ${ADDITIONAL_OPTIONS} >> ${DEFAULTS}
  echo '}' >> ${DEFAULTS}
  cat ${DEFAULTS}
  packageFile=eb-package.zip
  dotnet eb ${DOTNET_EB_COMMAND} --disable-interactive True -cfg "${DEFAULTS}" -o "${packageFile}"

(btw if you don't specify environment-type: LoadBalanced it creates a single instance EB app by default, which is not what the documentation suggests)

wizofaus avatar Aug 03 '24 01:08 wizofaus

(Also the other problem I'm having with dotnet eb deploy-environment is that even when there are critical errors like

8/12/2024 3:28:59 AM ERROR Stack named 'awseb-e-rzavgfep3p-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBV2LoadBalancerListener443].

It still seems to return exit code 0)

wizofaus avatar Aug 12 '24 03:08 wizofaus

@wizofaus Good afternoon. Based on last comment https://github.com/aws/aws-extensions-for-dotnet-cli/issues/331#issuecomment-2266308220 from @normj, have you you tried using dotnet eb package command? Please confirm if it works for your use case and confirm if this issue could be closed.

Thanks, Ashish

ashishdhingra avatar Jan 14 '25 23:01 ashishdhingra

This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Jan 25 '25 00:01 github-actions[bot]