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.

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

报告相同问题?

悬赏问题

  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题