By using AWS re:Post, you agree to the Terms of Use

Questions tagged with AWS Elastic Beanstalk

Sort by most recent

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

Cannot add environment variable through Ebextensions

I'm using .ebextensions to create VPCEndpoints so in the **Resources** section I've addded the needed section for the VPCEndpoint. Then after that in the **option_settings** section I'm trying to add an environment variable in my elastic beanstalk application referencing the created VPCEndpoint, but when i check the environment variables from the elastic beanstalk console the value is added as a plain text not the Ref of the VPCEndpoint (Check the screenshot) So how can i make it interpret the Ref of the endpoint ? ![Enter image description here](/media/postImages/original/IMkQEkAlsLRyCG5pYs1i8hkA) ``` Resources: NewsonarVPCEndpoint: Type: AWS::EC2::VPCEndpoint Properties: PrivateDnsEnabled: false SecurityGroupIds: - {"Fn::GetOptionSetting": {"Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "ALLOW_INBOUND_FROM_VPC_SECURITY_GROUP", "DefaultValue": "default_value"}} ServiceName: { "Fn::Join": [ "", [ "com.amazonaws.vpce.",{"Fn::GetOptionSetting": {"Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "AWS_REGION", "DefaultValue": "us-east-1"}},".",{"Ref": "sonarVPCEndpointService"}]] } SubnetIds: - { "Ref": "Subnet1Id" } - { "Ref": "Subnet2Id" } - { "Ref": "Subnet3Id" } VpcEndpointType: Interface VpcId: { "Ref": "VpcId" } option_settings: aws:elasticbeanstalk:application:environment: VPC_ENDPOINT: '`{"Ref" : "NewsonarVPCEndpoint"}`' ```
0
answers
0
votes
4
views
asked 5 hours ago

Elastic Beanstalk Node Static Files are not Loaded

I am having trouble serving my static files on Elastic Beanstalk using NodeJS deployed on Linux 2. My local environment works, but my deployment is unable to serve the static files located in a top-level static folder called 'public'. My configuration is as follows: ``` option_settings: aws:elasticbeanstalk:environment:proxy:staticfiles: /images: public/images /javascripts: public/javascripts /stylesheets: public/stylesheets ``` I am certain that the configuration is processed correctly because I can view the results of the static file configuration within AWS UI. When I navigate to the home directory of my site (using http:// protocol), the HTML page is loaded, but the CSS and JS under the public directory is not. The error I get is as follows: ``` GET https://<domain name>/stylesheets/layout.css net::ERR_CONNECTION_TIMED_OUT ``` Note that the https:// protocol is used. From my understanding, the reason my local environment works is that my application serves the static files with the correct protocol. Here are my questions: 1) Why are my static files being served with protocol https:// when I request my home directory using http://? 2) I don't want to serve my static files through the application to reduce the number of requests to my application, noted here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-environmentproxystaticfiles. Is there anything actually wrong with the configuration?
1
answers
0
votes
19
views
asked 4 days ago

How to install playwright in elastic beanstalk via .ebextensions?

I need to install [Playwright](https://playwright.dev/docs/ci#introduction) in my Elastic beanstalk. So, I am using this command in `.ebextensions` `.ebextensions/01_install_playwright.config` ``` container_commands: install_playwright: command: "npx playwright install --with-deps chromium" ``` But it's getting error out. Here are the logs from cfn-init.log - ``` 2022-09-29 05:16:17,188 [INFO] -----------------------Starting build----------------------- 2022-09-29 05:16:17,194 [INFO] Running configSets: Infra-EmbeddedPostBuild 2022-09-29 05:16:17,197 [INFO] Running configSet Infra-EmbeddedPostBuild 2022-09-29 05:16:17,200 [INFO] Running config postbuild_0_test_worker 2022-09-29 05:16:18,246 [ERROR] Command install_playwright (npx playwright install --with-deps chromium) failed 2022-09-29 05:16:18,246 [ERROR] Error encountered during build of postbuild_0_test_worker: Command install_playwright failed Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config CloudFormationCarpenter(config, self._auth_config).build(worklog) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build self._config.commands) File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply raise ToolError(u"Command %s failed" % name) cfnbootstrap.construction_errors.ToolError: Command install_playwright failed 2022-09-29 05:16:18,247 [ERROR] -----------------------BUILD FAILED!------------------------ 2022-09-29 05:16:18,247 [ERROR] Unhandled exception during build: Command install_playwright failed Traceback (most recent call last): File "/opt/aws/bin/cfn-init", line 176, in <module> worklog.build(metadata, configSets) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 137, in build Contractor(metadata).build(configSets, self) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 564, in build self.run_config(config, worklog) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config CloudFormationCarpenter(config, self._auth_config).build(worklog) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build self._config.commands) File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply raise ToolError(u"Command %s failed" % name) cfnbootstrap.construction_errors.ToolError: Command install_playwright failed ``` Am I missing something or any suggestion on how to run the npx command on .ebextensions. I also [posted on SO](https://stackoverflow.com/questions/73890683/how-to-install-playwright-dependency-in-elastic-beanstalk-ebextensions) but didn't see any response. While everything is working fine on code pipeline using buildspec.yml and same command ``` phases: install: runtime-versions: nodejs: 16 #nodejs: latest pre_build: commands: - echo Installing source NPM dependencies... - npm install - echo Installing Chromium... - npx playwright install --with-deps chromium ```
0
answers
0
votes
12
views
asked 4 days ago