doutang9037 2017-12-07 03:31 采纳率: 100%
浏览 14
已采纳

暂时将图像存储在弹性beanstalk api上

I have a PHP API that will be hosted on Elastic Beanstalk. The user uploads images to this API. Once the API gets it, in PHP I store the file in a temp folder, then resize it to multiple sizes then upload it to an S3 Bucket.

It works locally but I haven't put this live yet. Is this possible to do once it is on an elastic beanstalk instance? I know I have to give write permissions to the temp_image directory when I work with it locally so do I have to do this when it's live on elastic beanstalk? If so, how do I manage folder directories on an elastic beanstalk? And will I have to do this every time I update my API?

Another solution I thought of is having a temp_image S3 Bucket and working from that?

Any suggestions would be great thanks!

  • 写回答

1条回答 默认 最新

  • dongyi2159 2017-12-07 14:17
    关注

    ElasticBeanstalk deployments are considered immutable post-deployment, so you will probably have to change permissions on your temp folder. Thankfully, doing so is pretty straightforward. The mechanism for performing operations such as chmod or chown is through configuration files, described here. ElasticBeanstalk configuration files are invoked as part of a deployment, so the permissions should be applied automatically every time you update your API.

    In your case, you would use something like this:

    .ebextensions/01-make-temp-folder-writeable.config

    container_commands:
      chown_folder:
        command: "chown webapp temp_image"
      chmod_folder:
        command: "chmod 775 temp_image"
    

    Make sure you pay attention to your indentation - YAML files are very sensitive to whitespace.

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

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?