Deployment package did not contain an iisApp - amazon-web-services

I'm trying to upload a zip of files of a published .net project to Amazon elastic beanstalk but it keeps throwing an error in the logs saying iisApp is not there. How to fix?

Elastic Beanstalk expects a WebDeploy package, not just a zipped web application. You'll probably want to run:
msbuild <web.csproj> /t:Package /p:Configuration=Release /p:PackageLocation=<outputdirectory>
to create a WebDeploy package.

Related

AWS CodeDeploy agent is deleting files in the wrong folder during install

We have an unusual setup. We use git on Azure Devops for our code repositories, and AWS for our cloud-based services. In our arsenal we have a mixture of AWS Lambda functions, along with console apps, web apps, and Windows services running on EC2 instances. We have been able to create CI/CD pipelines for all three classes of apps. For the apps running on EC2 instances we use AWS CodeDeploy. These deployments are more complicated, but they all work -- except for one.
Another unusual thing about our setup is that both our development and QA environments are on the same EC2 instance. When the CodeDeploy agent running on that instance retrieves the deployment archive, it unpacks it, reads the appspec.yml file, runs our before install script, which backs up the existing installation and shuts down any services that might be using those files. Then, the install phase updates the files in the designated environment, then deletes -- or tries to delete -- all the files in the other environment folder.
In other words, if a DEV deployment is running, it replaces the files in the DEV folder and also tries to delete the files in the QA folder. I know this sounds like a scripting problem, but I have checked all the script and yaml files no where do I reference the opposing environment.
In this case, the app is a Windows service. Normally, I get a Ruby 'Permission denied # unlink_internal' error on a file in the other folder. As an experiment, I shut down the service in the other environment in my before install script and, as I expected, the agent deleted all the files in the other environment. It updated the files in the target environment, but left the folder in the other environment empty!
Here are my files. I suspect, the problem is being caused by something I did, but I can't, for the life of me, find it.
These are all .NET projects. In my solution I have a ConfigFiles folder set up with subfolders for each environment. Then, in my pipeline yaml file I run a script to select the correct files to move into the archive based on the git branch that is being built.
Here's the code for code for the script that selects the correct files.
Here's the Azure pipeline YAML file.
Here's my before install script:
And, finally, here is my appspec.yml file, which the CodeDeploy agent uses to know where to update the files during installation. How I want this to be the wrong path, but in the deployment archive, the environment specific values are all exactly right.
Any ideas on this one would be greatly appreciated.
I encountered the same problem where deployment of an app deletes files from another app in another folder unexpectedly. My solution is to use different deployment groups for each app, even though they are deploying to the same EC2 instance.
Deploying many apps on the same EC2 instance using the same deployment group results in files/folder deletion on other deployed projects.
From AWS Technical Support:
The reason is that codedeploy creates a clean up file by the format '[deployment group 1 ID]_cleanup" in the directory '/opt/codedeploy-agent/deployment-root/deployment-instructions' everytime a deployment is made to the deployment group and this file deletes all the files that had been installed during the previous deployment made to the deployment group. Since the deployment group is the same in your case, when you make a deployment to the deployment group which installs files to the folder "/var/www/project1", files installed by the previous deployment in the folder "/var/www/project2" are being cleaned up and vice versa which is an expected mechanism of the codedeploy agent.
You can find the explaination here: https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent.html#codedeploy-agent-install-files
Please consider creating two different applications/deployment groups
and configure the two pipelines to use different
applications/deployment groups which should fix your problem.

How to deploy KinesisAutoscaling.war on Java Application Server or Tomcat?

I want to manage kinesis shards automatically so I want to deploy KinesisAutoscaling.war on Tomcat. I found steps(https://github.com/awslabs/amazon-kinesis-scaling-utils) to deploy at Elastic Beanstalk.
Similar way I want step by step solution to deploy on Tomcat.
I was able to slow this problem using below steps.
Downlaod the code from here.
Open the project as Maven project in eclipse
Change the stream configuration in the configuration.json and provide the path of configuration in AutoscalingController.java like below
String configPath = "C:\
amazon-kinesis-scaling-utils-master\conf\configuration.json";
Build the project and place .jar file to the webapps folder of tomcat and start tomcat.

IntelliJ CE cannot load ~/.aws/credentials file using Smart Tomcat

I am trying to simply run Tomcat in IntelliJ. Since I am using IntelliJ CE, I am trying the Smart Tomcat plugin. It runs, but it cannot find my aws credentials which I have both in my maven file and in the ~/.aws/credentials file. Do I need any VM args? How else can I help this program find the files? Maven is able to load from the maven files fine.

Error on deploying .Net Core 2.0 Web API to AWS Elastic Beanstalk

I have used .Net Core 2.0 to build my Web API. Now I am trying to deploy this project to AWS using its Elastic Beanstalk Service. I am also using the Visual Studios AWS deployment tool.
During the deployment process, I am receiving the following error;
Error during deployment: Could not find a part of the path
'C:\inetpub\AspNetCoreWebApps\app\appsettings.Development.json'.
I have added the following section into my .csproj;
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
I can see that my appsettings.json and appsettings.Development.json are in my output folder when I build my project. Also they appear in the published directory if I publish the app into my local pc.
I could not understand why does Amazon's service can not pick it up...
Edit: So, interestingly I created a new .Net Core 2.0 Web Api project from Visual Studio templates and tried deploying it to AWS and it gave me the same error. However when I create an MVC project and deploy it to AWS everything works fine. The default settings for the web api template seems to be effecting the deployment somehow...
So I created a new .Net Core 2.0 MVC Project and migrated/adapted my web api to it. Now its deployed without any issues.
So if your project was started from a Web Api template and getting a simillar error, try switching between templates.
So after trial and error with including and excluding certain files, the problem is with WebApi because it does not have a wwwroot folder and it would appear the elastic beanstalk scripts are looking for this.
To make it work, I added a wwwroot folders and put a placeholder html file inside it and my project now deploys correctly!
Are you using AWS toolkit for VS 2017 to deploy your application. That would do a lot of the config work for you.
There are many problems with the AWS preconfigured environment for asp.net core 2 with IIS 10, try terminating your beanstalk environment and recreate and deploy through AWS toolkit directly from Visual Studio. Right click your project and use the "Publish to AWS Beanstalk"

How do I make a django project compatible with AWS Beanstalk?

I want to make a Django project compatible with AWS Beanstalk.
I dont want this to be like in AWS tutorial, since they use git and need to setup the whole project as they tell.
I just want to know if there is a way of converting an already created Python-Django project to be AWS Beanstalk compatible. I mean, isn't there a standard project layout to download or a plugin or command-line tool that creates the .ebsettings folder for me? I want to convert my project and upload it throw the AWS web gui, dont need all the git stuff.
You can do this without using git route. You just need to zip your source bundle and upload to the Beanstalk Web Console. The code structure can be kept the way you want.
Key configurations are:
1. WSGIPath : This should point to the .py file which you need to start the app (WSGI app)
2. static: This should point to the path containing the static files
You can add the configurations in the .ebextensions folder, which should at the root of your app zip. You can read more details here: Customizing and Configuring a Python Container - AWS Elastic Beanstalk