当我部署 Elastic Beanstalk 应用程序时,如何替换不再起作用的这个 AWS CLI 命令 [英] How do I replace this AWS CLI command that is no longer working when I deploy Elastic Beanstalk application

查看:20
本文介绍了当我部署 Elastic Beanstalk 应用程序时,如何替换不再起作用的这个 AWS CLI 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天必须重新部署我的弹性 beanstalk 应用程序,但由于取消对 Python 2 的支持的一些问题,它不再工作

I have to redeploy my elastic beanstalk application today and it is no longer working because of some issue with withdrawal of support for Python 2

实例:i-0872ed7568a9820f5] 命令在实例上失败.返回代码:1 输出:(TRUNCATED)...检测到:Python 2.7 继续使用此安装程序必须使用 Python 3.6 或更高版本.想要查询更多的信息请参阅以下博客文章:https://aws.amazon.com/blogs/developer/annoucing-end-of-support-for-python-2-7-in-aws-sdk-for-python-and-aws-cli-v1/..ebextensions/copyindexes.config 中的命令 01_install_cli 失败.为了更多详细信息,请使用控制台或 EB CLI 检查/var/log/eb-activity.log.

Instance: i-0872ed7568a9820f5] Command failed on instance. Return code: 1 Output: (TRUNCATED)...detected: Python 2.7 To continue using this installer you must use Python 3.6 or later. For more information see the following blog post: https://aws.amazon.com/blogs/developer/announcing-end-of-support-for-python-2-7-in-aws-sdk-for-python-and-aws-cli-v1/. command 01_install_cli in .ebextensions/copyindexes.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

我不直接使用 Python 2,但已将问题追踪到我的 .ebextensions 文件夹中的 copyindexes.config 文件包含以下行

I dont directly use Python 2, but have tracked down the issue to copyindexes.config file i have in my .ebextensions folder and contains the following line

    01_install_cli:
            command: wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip; unzip awscli-bundle.zip;  ./awscli-bundle/install -b ~/bin/aws
    
    02_get_index:
         command:
           aws s3 cp --region eu-west-1 s3://jthink/release_index_21.tar.gz /home/ec2-user/release_index.tar.gz;
           aws s3 cp --region eu-west-1 s3://jthink/artist_index_21.tar.gz /home/ec2-user/artist_index.tar.gz;
           cd /usr/share/tomcat7;
           tar -xvf /home/ec2-user/release_index.tar.gz;
           tar -xvf /home/ec2-user/artist_index.tar.gz;
           rm /home/ec2-user/release_index.tar.gz;
           rm /home/ec2-user/artist_index.tar.gz;

我应该如何将其更改为以解决问题

How should I change this to to resolve the issue

更新

好的,所以我将脚本修改为

Ok so I modified script to

   01_install_cli:
    command: wget https://s3.amazonaws.com/aws-cli/awscli-bundle-1.18.200.zip; unzip awscli-bundle-1.18.200.zip;  ./awscli-bundle/install -b ~/bin/aws

那一点似乎有效,但后来在 eb_activity.log 中我现在得到了

That bit seemed to work but then in eb_activity.log I now get

  Traceback (most recent call last):
    File "/usr/lib64/python2.7/logging/__init__.py", line 884, in emit
      stream.write(fs % msg.encode("UTF-8"))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 49: ordinal not in range(128)
  Logged from file util.py, line 476
  Traceback (most recent call last):
    File "/usr/lib64/python2.7/logging/__init__.py", line 884, in emit
      stream.write(fs % msg.encode("UTF-8"))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 72: ordinal not in range(128)
  Logged from file util.py, line 476

所以看起来我选择了一个糟糕的版本,我应该选择什么?

So looks like I picked a bad version , what should I have picked ?

我尝试了 1.19.0 和相同的错误,所以问题可能是 aws-cli 版本,但它是什么

我只修改了下载和安装 cli 行,当我的安装行错误时,它给出了错误,所以我必须正确但我不知道这个新错误来自哪里.

I've only modified the download and install cli line, when I had the install line wrong it gave error about that so I must have that right but I have no idea where this new error is coming from.

推荐答案

您可能已经知道 Python 2 已弃用.为了将 AWS CLI 版本 1 与较旧版本的 Python 一起使用,您需要安装较早版本的 AWS CLI 版本 1.

As you probably already know Python 2 is deprecated. In order to use the AWS CLI version 1 with an older version of Python, you need to install an earlier version of the AWS CLI version 1.

Python 软件基金会于 2020 年 1 月 1 日弃用了 Python 2.7.展望未来,使用 AWS CLI 版本 1 的客户应过渡到使用 Python 3,至少要使用 Python 3.6.从 2021 年 7 月 15 日开始,新版本的 AWS CLI 版本 1 不再支持 Python 2.7.

Python 2.7 was deprecated by the Python Software Foundation on January 1, 2020. Going forward, customers using the AWS CLI version 1 should transition to using Python 3, with a minimum of Python 3.6. Python 2.7 support is deprecated for new versions of the AWS CLI version 1 starting 7/15/2021.

在此处查看官方 AWS 文档

最好的,斯蒂芬

这篇关于当我部署 Elastic Beanstalk 应用程序时,如何替换不再起作用的这个 AWS CLI 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆