Questions tagged with AWS CodePipeline

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

AWS Elastic beanstalk

I am facing an error "Service:AmazonCloudFormation, Message:Template error: instance of Fn::GetAtt references undefined resource AWSEBLoadBalancer" in AWS Elastic beanstalk. **Scenario:** * To implement CI/CD, I am using multiple services: Bitbucket, Codepipeline, codebuild. * In Codebuild, I have been using AWS CLI command to deploy the artifact from S3 bucket to one of the beanstalk environment. * As AWS elastic beanstalk uses different Cloudformation Template for every environment to update it, this error log which i am getting in beanstalk environment is related to Cloudformation. * I prefer experimenting new things in my personal account rather than company's account, keeping that in context here, I created the IAM user and provided the required permissions to run the whole architecture, and its running successfully using that account. *I faced this error in my company's IAM Account for the first time, so i created this same error in my personal Account's IAM account. * As the error log in newly created beanstalk environment was related to Cloudformation template, so i checked the logs in environment and got to know the status for this template was *"CREATE_COMPLETE"*. * So I then checked out the status of Cloudformation template of old environment in which the whole CI/CD was working absolutely fine, and I found that status was *"UPDATE_COMPLETE"*. * In order to make the status of newly created beanstalk environment as "UPDATE_COMPLETE", I manually uploaded an artifact to this environment which changed the status of cloudformation template as "UPDATE_COMPLETE". * And then when I ran the CI/CD, whole architecture worked very well. * So this worked in my personal account's IAM account, but when I am trying to do the same in my Company's account IAM account(account provided to me by them), its showing the same error in beanstalk evironment even after providing the same IAM permissions and following the same drill. *Can someone help me to figure out this scenario that what could be the possible reasons?* ![Please refer this image for the exact error](/media/postImages/original/IMB4vvrfujRyy6ILN8KpTt8A)
0
answers
0
votes
18
views
asked 13 days ago

ASP.NET Core Application not Running in AWS Linux EC2 instance instead showing Apache Test Page

I have have an AWS CodePipeline process that gets the CodeCommit repository builds the application and publish the application to the Linux EC2 instances. The entire process executes successfully and I can see the final asp.net core application gets published to the /var/www/html/ folder. But when I get loads the URL of the load balancer (EC2 instances are behind a load balancer), I see the Apache test page, not the asp.net core application. The asp.net core application I created is just the default asp.net core web application that gets created by default. Below is the buildspec.yaml file. (This publishes a self-contained application) ``` version: 0.2 env: variables: DOTNET_CORE_RUNTIME: 6.0 phases: install: on-failure: ABORT runtime-versions: dotnet: ${DOTNET_CORE_RUNTIME} commands: - echo install stage - started `date` pre_build: commands: - echo pre build stage - stared `date` - echo restore dependencies started `date` - dotnet restore ./WebApplication1/WebApplication1.csproj build: commands: - echo build stage - started `date` - dotnet publish --configuration Release --runtime linux-x64 ./WebApplication1/WebApplication1.csproj --self-contained - cp ./WebApplication1/appspec.yml ./WebApplication1/bin/Release/net6.0/linux-x64/publish/ artifacts: files: - '**/*' - appspec.yml name: artifact-test-cham discard-paths: no base-directory: ./WebApplication1/bin/Release/net6.0/linux-x64/publish/ ``` And below is the appspec.yaml file that copies the content from the S3 artifact location to the /var/www/html/ folder ``` version: 0.0 os: linux files: - source: / destination: /var/www/html/ ``` Following image shows that the web application gets successfully published to the /var/www/html folder in the Linux EC2 instance with other asp.net core framework dependent files. But even though all the web application files along with other framework files are available, as I said, when I navigate through the load balancer, I can see the Apache test page only. ![Enter image description here](/media/postImages/original/IMrj2EksFtRkigsg3lcuTJBA) Below is the "Configure" method in the application. ``` // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseStatusCodePages(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); } ``` What am I doing wrong in here? Do I have to do something from the application side? Please let me know. UPDATE: Below is the instance UserData used to in each EC2 instance. ``` #!/bin/bash -xe sudo su sudo yum -y update yum install -y ruby yum install -y aws-cli sudo amazon-linux-extras install -y php7.2 sudo yum install httpd -y sudo systemctl start httpd sudo systemctl enable httpd sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm cd /home/ec2-user # downloading & installing CodeDeploy Agent as per https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-simple-s3.html#S3-create-instances aws s3 cp s3://aws-codedeploy-${AWS::Region}/latest/install . --region ${AWS::Region} chmod +x ./install ./install auto ```
2
answers
0
votes
65
views
champer
asked 15 days ago