Questions tagged with AWS Elastic Beanstalk

Content language: English

Sort by most recent

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

Good morning, I have an Elastic Beanstalk environment stuck updating. I switched the auto-scaling to zero (desired, min, max) and the instance has been removed. But the status is still "updating". The last operation was to add a listener to the ELB through the EB UI to open port 443. I tried to remove manually the listeners from the ELB but nothing changed. I can't deploy, abort the operation, or clone. What should I do?
0
answers
0
votes
7
views
Ale
asked 4 hours ago
Hi, We are looking into ways to best monitor our Beanstalk environment, in the most dynamic way possible. Meaning we would like to be able that whenever we have a new instance to set corresponding metric alarms, we are interested in. Since our environment was built long time ago and does not have much automation around it I have decide to leverage some CDK code, and build Clouwatch code that we can run on a schedule to detect differences and add/remove monitoring to new instances accordingly. Another option was to use eventBridge and trigger lambdas and based on some SDK code get the proper monitoring in place. The question is, based on the situation above, does eb-extensions or any other Beanstalk feature allow us to set "metric alarms" from within Beanstalk during deployment (not using the console), or other ways using other parts of the Beanstalk infrastructure to set those alarms upon deploying new app build versions? **Update:** After doing some digging into eb-extensions looks like we can use custom resources, but is there a way that when setting the alarm I can use insatnce IDs for the dimensions, to set the alarm per instance in the environment ? example: ``` MetricName: "RootFilesystemUtil" Namespace: "AWS/ElasticBeanstalk" Dimensions: - Name: InstanceId Value: <ref_all_instances_in_the_env> ```
1
answers
0
votes
14
views
Ziad
asked 2 days ago
I'm trying to create a Beanstalk Environment in CloudFormation that will use an existing shared application load balancer, rather than one created by Beanstalk. Unfortunately I get an error in Beanstalk suggesting that I'm not referencing the load balancer correctly. > Service:AmazonCloudFormation, Message:Template format error: Unresolved resource dependencies [AWSEBV2LoadBalancer] in the Resources block of the template ![ElasticBeanstalk events](/media/postImages/original/IMHwimNYwHQdCUuIFjDIYPOw) In my CloudFormation template I have the following: ```yaml Resources: ConfigurationTemplate: Type: AWS::ElasticBeanstalk::ConfigurationTemplate Properties: ApplicationName: !ImportValue Fn::Sub: "${ApplicationStackName}-ApplicationName" SolutionStackName: !Ref StackType OptionSettings: - Namespace: aws:elasticbeanstalk:environment OptionName: EnvironmentType Value: LoadBalanced - Namespace: aws:elasticbeanstalk:environment OptionName: LoadBalancerIsShared Value: true - Namespace: aws:elasticbeanstalk:environment OptionName: LoadBalancerType Value: application - Namespace: aws:elbv2:loadbalancer OptionName: SharedLoadBalancer Value: Fn::ImportValue: !Sub "${SharedLoadBalancerStackName}-LoadBalancer-Arn" ``` I have double-checked and the export is available where we're importing it from. Any idea why I would be getting the load balancer-related error in Beanstalk? For completeness, and in case I'm misunderstanding, I'm using instructions from [1], and [2] to try add a listener to the load balancer from the Beanstalk CloudFormation template but the Lambda doesn't get executed so I guess we don't make it this far. ```yaml LambdaBasicExecutionRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: lambda.amazonaws.com Action: sts:AssumeRole Path: / ManagedPolicyArns: - arn:aws:iam::aws:policy/AWSCloudFormationReadOnlyAccess - arn:aws:iam::aws:policy/AWSElasticBeanstalkReadOnly - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole GetEBLBTargetGroupResource: Type: Custom::GetEBLoadBalancerArn Properties: ServiceToken: !GetAtt GetEBLBTargetGroupLambda.Arn EBEnvName: !Ref Environment # Query EB for its first load balancer's ARN GetEBLBTargetGroupLambda: Type: AWS::Lambda::Function Properties: Description: Get ARN of ElasticBeanstalk load balancer Handler: index.handler Timeout: 30 Role: !GetAtt 'LambdaBasicExecutionRole.Arn' Runtime: nodejs12.x Code: ZipFile: | const AWS = require('aws-sdk'); const cfnResponse = require('cfn-response'); const eb = new AWS.ElasticBeanstalk(); const cfn = new AWS.CloudFormation(); exports.handler = (event, context) => { if (event['RequestType'] !== 'Create') { console.log(event['RequestType'], 'is not Create'); return cfnResponse.send(event, context, cfnResponse.SUCCESS, { Message: `${event['RequestType']} completed.`, }); } eb.describeEnvironmentResources( { EnvironmentName: event['ResourceProperties']['EBEnvName'] }, function (err, { EnvironmentResources }) { if (err) { console.log('Exception', err); return cfnResponse.send(event, context, cfnResponse.FAILED, {}); } const PhysicalResourceId = EnvironmentResources['AutoScalingGroups'].find( (group) => group.Name )['Name']; const { StackResources } = cfn.describeStackResources( { PhysicalResourceId }, function (err, { StackResources }) { if (err) { console.log('Exception', err); return cfnResponse.send(event, context, cfnResponse.FAILED, {}); } const TargetGroup = StackResources.find( (resource) => resource.LogicalResourceId === 'AWSEBV2LoadBalancerTargetGroup' ); cfnResponse.send(event, context, cfnResponse.SUCCESS, { TargetGroupArn: TargetGroup.PhysicalResourceId, }); } ); } ); } ListenerRule: Type: AWS::ElasticLoadBalancingV2::ListenerRule Properties: Priority: 1 ListenerArn: Fn::ImportValue: !Sub '${SharedLoadBalancerStackName}-Listener-Arn' Actions: - Type: forward TargetGroupArn: Fn::GetAtt: [ 'GetEBLBTargetGroupResource', 'TargetGroupArn' ] Conditions: - Field: path-pattern PathPatternConfig: Values: [ '/*' ] ``` [1] https://stackoverflow.com/questions/67322501/cloudformation-elasticbeanstalk-specify-target-group-for-shared-load-balancer [2] https://stackoverflow.com/questions/65677754/awswafv2webaclassociation-resourcearn-for-application-load-balancer-in-cloud/65729457#65729457
1
answers
0
votes
6
views
asked 2 days ago
Hi, I have a Step Functions Express state machine for which I start executions with AWS SDK for PHP (StartExecution API). My code is running on an EC2 instance (Docker container on t3.micro) in a load balanced Beanstalk application. For the API call to start an execution, the total time it takes (everything included) is between 155ms and 500ms. The average is around 200ms. This is quite high and is a problem for us. My first question is if this is unusually high, or if this is normal? I tried starting the same workflow through API Gateway and saw roughly the same response times (or maybe slightly lower). I also tried using the PutItem API for a DynamoDB table and saw an average of around 200ms. Am I correct in assuming that these numbers should be lower? If my assumption is correct, I am thinking that maybe this is caused by the network path from my EC2 instance to the AWS API. My Beanstalk application is not using a VPC (though the EC2 instance is in the default VPC). Perhaps things could be improved by using a VPC and PrivateLink (VPC interface endpoint)? https://docs.aws.amazon.com/step-functions/latest/dg/vpc-endpoints.html So; 1. Is an average of 200ms unusually high or is this to be expected? 2. If #1 is true, should I expect using VPC/PrivateLink to improve this? 3. Which response times (everything included) should I expect (roughly/ballpark)? Thanks a lot!
0
answers
0
votes
15
views
thdev
asked 2 days ago
I used to have HTTPS working on my Beanstalk environment but in the attempt of allowing access to another service I messed up something and I can't get it working again. ATM my configuration is: Elastic Beanstalk * An active listener on port 443 with the appropriate certificate * A process on port 80, Health check path: / EC2 and Security groups: * One security group allowing inbound from 443, 80 and 27017 * Outbound all ports all IPs What I think I messed up: How to determine the correct origin for the security groups? Also, is there anything wrong on this setup? I read many guides, I am not going to terminate the https connections like explained in this guide https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-https-configuration/ simply because I haven't done it before and it was working. Do I really need it? thanks M
2
answers
0
votes
14
views
asked 2 days ago
Hello, I have an application whose code is split between two repositories, and I would like to use code pipeline to combine them. The first one contains the actual code and needs to be built. The second contains a .env file with parameters needed to run the build. It also needs to be deployed to Beanstalk for the application to run properly. What I tried so far: * I defined a source that is triggered by commits to repo A, and outputs the artifacts to SourceArtifacts. * Then I defined another source that is triggered by commits to repo B, and outputs the artifacts to SourceArtifacts2. * Then I defined a Build stage that uses SourceArtifacts and SourceArtifacts2 as Input Artifacts, runs the build command and outputs to BuildOutput. * Finally I defined a deploy stage that gets the code from BuildOutput and deploy to Beanstalk. My problem is that when the build runs it can't access the values in the .env file, so it fails. Also the .env file from repo B is not deployed. I was wordering if there's any specific workaround to achieve this. thanks M
6
answers
0
votes
23
views
asked 4 days ago
I need to deploy to Elastic Beanstalk a next.js application which reads some values from a .env file in my local dev environment. I was suggested to use a .config extension, but I don't want to put this file under version control. Is there any other option? AWS secrets manager is a bit expensive so I'd prefer not to use it. thanks M
Accepted AnswerAWS Elastic Beanstalk
1
answers
0
votes
10
views
asked 4 days ago
Hello, I created an Elastic Beanstalk application (node) that needs to connect to DocumentDB. I also created the DocumentDB cluster, following this guide: https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-ec2.html my problem is that I am not sure I should connect the Security Group to a EC2 instance, what happen if I decide to recreate the beanstalk environment? Should I maybe connect the Security Group to the Load Balancer? What's the best approach for this use case? thanks M
3
answers
0
votes
23
views
asked 4 days ago
I have a node application that I need to depoy to Elastic Beanstalk. I am using Code Pipeline to run the build and to deploy to Beanstalk, but then I need to start (npm start) the node server. How can I run the start command on Beanstalk after the code is deployed? Please note I am not using Code Deploy, the pipeline is deploying directly to Banstalk. Or do I need to use it (Code Deploy)?
1
answers
0
votes
18
views
asked 5 days ago
Hello, I am trying to create a new elasticbeanstalk application in us-east-1 region. using eb create command **eb create optimization-app** I have also tried to specify a service-role **eb create optimization-app --service-role aws-elasticbeanstalk-service-role** I am getting an exception **ERROR: AlreadyExistsError - Cannot exceed quota for PoliciesPerRole: 10** I have tried creating a new service role with only 2 policies on that role and tried to create the application but i still get the same error. This used to work till a few days ago. I am not sure what is the reason. I am not getting any other message to check the reason for this. Any help is appriciated. Best, Pavan
1
answers
0
votes
10
views
asked 5 days ago
I have a script that is running in account A that updates the application in Beanstalk. I want to run the same script from account A to update the Beanstalk application in account B using SSM or any other tool that could accomplish this task. I need to know what SSM command to invoke for the cross-account in the script below: ``` #!/bin/bash for i in ${eb_env_vars[@]} do if [[ $i == *"parameter_store_path"* ]]; then parameter_store_path=$(echo $i | grep -Po "([^\=]*$)") fi done ``` Your help would be greatly appreciated!
1
answers
0
votes
17
views
Sam
asked 8 days ago
I want to automate the deployment of the spring boot application from GitHub to AWS elastic beanstalk (ebs). I tried both the AWS code pipeline and code star. But I keep facing permission and policy requirement errors. Not sure what the required permissions are. I will really appreciate any guidance on how to do this, with examples if possible. The background to this question is that I am trying to move my application from Heroku to AWS. I use Guthub as my repository. Thanks!
1
answers
0
votes
31
views
asked 9 days ago