Unable to pass private key as an environment variable in AWS EB

前端 未结 1 1277
感情败类
感情败类 2021-01-15 01:37

I have been trying to add a private key into the eb environment variable configuration and have tried removing the newline, changing the (\"\") to (\'\') but neither of whic

1条回答
  •  醉梦人生
    2021-01-15 02:17

    Here is an example of securely downloading a .json file from S3 to your Elastic Beanstalk server. See the AWS documentation for reference. If you use your default elastic beanstalk bucket like in the AWS example, you don't need to worry about setting up permissions on the S3 bucket.

    Here is the documentation for the file and container_commands directives. In this example, you are downloading the firebase config file to the /etc/pki/tls/certs/ directory. You can modify this location as needed.

    # .ebextensions/firebase.config
    
    # Make sure to update the bucket policy on the S3 bucket to
    # allow access by the aws-elasticbeanstalk-ec2-role
    Resources:
      AWSEBAutoScalingGroup:
        Metadata:
         AWS::CloudFormation::Authentication:
            S3Auth:
              type: "s3"
              buckets: ["my-bucket"]
              roleName:
                "Fn::GetOptionSetting":
                  Namespace: "aws:autoscaling:launchconfiguration"
                  OptionName: "IamInstanceProfile"
                  DefaultValue: "aws-elasticbeanstalk-ec2-role"
    
     files:
       "/etc/pki/tls/certs/firebaseadminsdk.json":
          mode: "000400"
          owner: nodejs
          group: nodejs
          authentication: "S3Auth"
          source: https://s3-us-west-1.amazonaws.com/my-bucket/firebase-adminsdk-abcde-fghijklmn.json
    

    0 讨论(0)
提交回复
热议问题