dpz90118 2018-04-12 19:13
浏览 41
已采纳

在部署时从ELB env变量设置Newrelic APP名称

I need to deploy the same PHP code to 3 environments on AWS Elastic beanstalk. These environments will report to different Application Names on New relic.

The newrelic license key cannot be deployed to the repository.

Please advise on strategies to achieve this.

  • 写回答

1条回答 默认 最新

  • dongmaoxi0477 2018-04-27 22:20
    关注

    For PHP in AWS Elastic Beanstalk you the steps are:

    In the .ebextensions folder inside your Elastic BeanStalk application, create a new file named newrelic.config. Add the following content to the file:

    packages:
      yum:
        newrelic-php5: []
      rpm:
        newrelic: INSERT_LINK_TO_AGENT
    commands:
      configure_new_relic:
        command: newrelic-install install
        env:
          NR_INSTALL_SILENT: true
          NR_INSTALL_KEY: INSERT_LICENSE_KEY
    

    From: https://docs.newrelic.com/docs/agents/php-agent/frameworks-libraries/aws-elastic-beanstalk-installation-php

    If you are using password vault you would then follow their best practices. If you are not then you may have to create a shell script to replace the license key from a secure S3 bucket.

    Put your license key in a secure S3 bucket. Then use a Bash script similar to:

    #!/bin/bash
    password=$(aws ssm get-parameters --region us-east-1 --names MySecureLicenseKey --with-decryption --query Parameters[0].Value)
    # code to replace INSERT_LICENSE_KEY - need to update the path to where you have it land
    sed 's/INSERT_LICENSE_KEY/$password/g' /etc/newrelic/newrelic.config
    

    Inspired by: https://aws.amazon.com/blogs/mt/use-parameter-store-to-securely-access-secrets-and-config-data-in-aws-codedeploy/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动