Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 2 tasks
wizofaus opened this issue Jul 31, 2024 · 4 comments
Labels
feature-request A feature should be added or improved. module/cli-ext p2 This is a standard priority issue

Comments

@wizofaus
Copy link

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

  • 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 wizofaus added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jul 31, 2024
@bhoradc bhoradc added module/cli-ext needs-review p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jul 31, 2024
@ashishdhingra
Copy link
Contributor

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

@normj
Copy link
Member

normj commented Aug 3, 2024

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.

@wizofaus
Copy link
Author

wizofaus commented Aug 3, 2024

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
Copy link
Author

(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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. module/cli-ext p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

4 participants