change the AWS CLI from 1 to 2 - amazon-web-services

When checking the AWS PATH with which aws when changing the AWS CLI from 1 to 2
/Users/username/.pyenv/shims/aws
I used to install via pyenv, but I want to remove it and install it according to system 2, but even if I try it according to the official doc, it is not changed to system 2.
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
It did not change to the 2 system even if I typed this command.
I've also tried uninstalling the AWS CLI, but it doesn't work.
Does anyone know of any way to do this?
thank you

I removed my old aws cli from ~/.pyenv/versions/x.x.x/bin/aws, where x.x.x is the current Python version.
Get the current version:
$ pyenv versions
* 3.7.4
Remove aws cli from current pyenv bin:
$ rm -rf ~/.pyenv/versions/3.7.4/bin/aws*
Try again which aws:
$ which aws
/usr/local/bin/aws

I had the same issue.
This is because pyenv linked the shim to very Python version that command has been installed originally with; that's by the way ok to avoid version conflicts. pip3 and awscli v3 uninstall don't take care of that.
What you have to do is to:
First, uninstall the old awscli as noted in the AWS documentation (probably you used pip3). Note: remember to edit your bash_profile or zshrc as you may have a $HOME/.local/bin PATH in your config: you want to remove that too
The aws shim will remain in place until you get rid of that Python version (pyenv uninstall 3.7.x) BUT YOU PROBABLY DON'T WANT THAT
Just remove the shim manually rm /Users/username/.pyenv/shims/aws
Install the AWS CLI v2 using the recommended installed and verify everything works correctly

I had the same issue in my Windows system because of I was having both AWS CLI and AWS CLI v2 installed but PATH environment variable was corrupted because of installing AWS CLI 2 multiple times.
I removed AWS CLI (means version 1) from that PATH or Path or path variable and I pointed to my AWS CLI v2 folder like C:\Program Files\Amazon\AWSCLIV2\aws.exe. Then all my AWS CLI v2 and kubernate 0.xx.x all set by itself. When I check with aws --version, I get aws 2 version always now.
So, install AWS CLI 2 and also check your path system environment variable. I think no need of work around Python version. Please refer to AWS documentation at https://docs.aws.amazon.com/cli/latest/userguide/cliv2-migration-instructions.html#cliv2-migration-instructions-side-by-side

Related

nvm is not compatible with the npm config "prefix" option: currently set to "" Run `nvm use --delete-prefix v18.1.0` to unset it

I am using ssh to connect Github with AWS EC2 and I am trying to install the node so I can run my server in VM. but it is showing me an error says
"nvm is not compatible with the npm config "prefix" option: currently. set to ""Run nvm use --delete-prefix v18.1.0 to unset it."
This isn't really a solution, but I got around the issue by changing to an older version of Node (v15 rather than the default v18) that doesn't require the latest GLIBC.
Run nvm install 15 and nvm use 15

How do I install fontconfig on AWS lambda?

This is a continuation of How do you install phantomjs on AWS lambda? I've figured out how to get phantomjs running on an aws lambda, but when I use it to generate pdfs (using the html-pdf nodejs library), the content is missing text. If I create a docker container that's using FROM node:10.16.0-jessie on it, the pdfs render fine. If I create a docker container using FROM amazonlinux:2.0.20190508 (which I think is similar to the AWS lambda container), the text is missing on my PDFs.
I've fixed this problem in amazonlinux:2.0.20190508 by running yum install fontconfig. But, I don't know how to do the equivalent of a yum install fontconfig inside a real lambda. If you look at the link above, you'll see that an answer there attempts to provide that information, but for whatever reason, it still doesn't work correctly. I believe the reason is there's still a missing step on how to get the fontconfig install properly extracted from the amazonlinux:2.0.20190508 container.
In summary, here is my question: After I run yum install fontconfig in amazonlinux:2.0.20190508, how do I extract it from the container and package it up so that an AWS Lambda can use it?
By the way, I'm sure there are other answers that seem to be answering this question, but the AWS lambda built-in dependencies change so frequently, none of those answers work anymore.
In my case, I did this:
Create a Docker file with content:
FROM amazonlinux:2.0.20190508
RUN yum -y install fontconfig freetype
and build it as example:latest
Run docker and mount folder:
docker run -v D:\dockerFiles:/mnt --rm -it example:latest
Found libraries inside docker by path /lib64
libbz2.so.1 libexpat.so.1 libfontconfig.so.1 libfreetype.so.6 libpng15.so.15
Copy it to /mnt/lib. Take lib from D:\dockerFiles and zip folder lib.
Create aws lambda layer and add to lambda.

How to upgrade version of terraform in windows

How to upgrade version of terraform in windows. Now i am using 0.9 and on windows using git bash. can someone help me with the process or commands.
Note: I did some google search but no use.
Thanks
I know you specified using bash but this is the first answer that comes up in searches so this is more FYI for future travelers.
To find the location of terraform.exe in powershell:
(get-command terraform.exe).Path
I had used Chocolaty to install Terraform so to upgrade:
choco upgrade terraform
This is using Git Bash on Windows
Download the latest version and unzip it
Navigate to that folder through your bash CLI
Now type which terraform
Copy the path of the terraform
Now type
cp terraform.exe <your Terraform path>
e.g. cp terraform.exe /c/WINDOWS/System32/terraform
Now check by using
terraform --version
Firstly, I would read the upgrade guides written by Hashicorp to make upgrading versions transparent. In your case I would read both 0.10 and 0.11 as they're likely to have changes that will affect you.
Secondly, in addition to this test in isolation with later versions of Terraform, i.e. not using remote state file and in a sandbox environment.
Lastly, locate where the current Terraform binary is located, perhaps check your Environment Variables for a PATH that may lead to where the executable is, and replace that with the latest version of Terraform which you can download here.
Use
choco install terraform --version=0.12.14 --force
to install version that you like.

gsutil Updates are available check

On seemly random occasions running a gsutil command it displays:
Updates are available for some Cloud SDK components. To install them,
please run:
$ gcloud components update
My issue is that I run gsutil commands programmatically on a "server" so I don't see this message as it does not appear in either Standard Out or Err from .Net Process.
I see there is a gsutil version command but I don't see a query to do a check if I have the current version.
Is there a gsutil, or other GCP SDK command, I can run that will tell me if my local copy needs to be updated with output via Standard Out?
Here is the output from Version -l
H:\OUTREACH\WEBSITE\GCP>gsutil version -l
gsutil version: 4.27
checksum: 522455e2d24593ff3a2d3d237eefde57 (OK)
boto version: 2.47.0
python version: 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
OS: Windows 7
multiprocessing available: False
using cloud sdk: True
pass cloud sdk credentials to gsutil: True
config path(s): xxxx
gsutil path: xxxx
compiled crcmod: True
installed via package manager: False
editable install: False
gsutil tool comes with Cloud SDK. When you run gsutil it actually invokes a gcloud wrapper which forwards its credentials to gsutil. Among other things it occasionally checks if newer versions of Cloud SDK are available.
If you do not wish this check to be performed, you can disable it by setting corresponding gcloud property via
gcloud config set component_manager/disable_update_check true
To actually check if update is available you can run
gcloud components list
which will display something like
Your current Cloud SDK version is: 163.0.0
The latest available version is: 165.0.0
To update run gcloud components update.
You can find out if a new copy of gsutil is available by running:
gsutil update
Also, you can avoid having updates offered when running on your server by setting the software_update_check_period variable, as described in https://cloud.google.com/storage/docs/gsutil/commands/update.

Trouble installing AWS Elastic Beanstalk Command Line tool packages

I'm having trouble installing AWS Elastic Beanstalk command line tool and I don't understand why. I've downloaded the package from AWS and followed the instruction carefully. Following is the installation instruction:
== Installation
Once you have downloaded the CLI package:
1) Unzip this archive to a location of your choosing.
Eb is located in the "eb" directory. The complete CLI reference
for more advanced scenarios can be found in the "api" directory.
To add eb files to your path:
Linux/Mac OS X (Bash shell):
export PATH=$PATH:<path to eb>
Windows:
set PATH=<path to eb>;%PATH%
I'm using Mac OS X so I've used export PATH=$PATH:. For the path to eb, I've just copied the file into the terminal, which resulted export PATH=$PATH:/Users/lydia/Downloads/ElasticBeanstalk/eb/macosx/python2.7/eb. I'm not sure what I'm missing and I can't deploy without downloading eb command line first.
Remove the eb at the end so it's just
/Users/lydia/Downloads/ElasticBeanstalk/eb/macosx/python2.7/
this worked for me although i can only get it to work if i export the CLI into the specific website folder i am working on see my question here https://askubuntu.com/questions/428417/aws-elastic-beanstalk-command-line-tool-setup
Fix that worked for me (if you installed python using brew) is remove python via
brew uninstall --force python
and then install it again from https://www.python.org/downloads/.
Then just follow the instructions from AWS.
You only add directories to your $PATH. Is ~/Downloads/ElasticBeanstalk/eb/macosx/python2.7/eb a directory? Or is it the actual command?