I am looking to install the AWS CLI on a Windows Server Core EC2 instance. As per the Documentation, the AWS CLI should be installed with msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi.
The problem with this, is that it will attempt to bring up a GUI - Windows server core does not have any GUI, and therefore we cannot interact with it. I have tried /quiet and other such commands, but the terminal simply gives no response.
How can I install the AWS CLI on a Windows Server Core EC2 instance?
Install the AWS Command Line Interface (CLI)
AWS Command Line Interface (CLI) Silent Install (MSI)
Navigate to: https://aws.amazon.com/cli/
Download the AWSCLIV2.msi to a folder created at (C:\Downloads)
Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
Navigate to the C:\Downloads folder
Enter the following command: MsiExec.exe /i AWSCLIV2.msi /qn
Press Enter
After a few moments you will find AWS Command Line Interface (CLI) entries in the Installation Directory and Programs and Features in the Control Panel.
aws ec2
you can follow the step
it will be help you to install AWS CLI you can open this below link
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html
you can install cli
and run command in terminal ➡ aws configure
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json
insert your information in above like this
hope it will help for you...
amazonwebservices aws ec2
Related
I have installed the latest versions of the aws-cli-2 and docker, as well as ran "aws configure" and entered my access key and secret key. I have also verified the aws.config is correct and showing the right region and output format. My credentials in AWS are admin. I keep getting the following error:
'''Unable to locate credentials. You can configure credentials by running "aws configure".
Error: Cannot perform an interactive login from a non TTY device'''
Even though I have already ran 'aws configure.' I am running the commands prefixed with 'sudo' as well. Any thoughts?! Thank you for your time!
The aws configure command was being run as the local user, whereas the ecr command was being run as sudo.
If you run commands as sudo it will not have access to your local users config, it will instead default to the root users.
Instead ensure all commands are run as the same user.
If you want to use the aws credentials file from the default location you can also specify the location via the AWS_CONFIG_FILE environment variable.
I am new to AWS and I am trying to register an image on ECR on windows. To do that I am using PowerShell to connect to AWS.
Below is my version
PS C:\> aws --version
aws-cli/2.0.0 Python/3.7.5 Windows/10 botocore/2.0.0dev4
I used aws configure command to login. I went to users -> createdUser -> Security Credentials for Access key and Secret key.
When I use Get-ECRLoginCommand
PS C:\> Get-ECRLoginCommand
Get-ECRLoginCommand : The request signature we calculated does not match the signature you provided. Check your AWS
Secret Access Key and signing method. Consult the service documentation for details.
At line:1 char:1
+ Get-ECRLoginCommand
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Amazon.PowerShe...inCommandCmdlet:GetECRLoginCommandCmdlet) [Get-ECRL
oginCommand], InvalidOperationException
+ FullyQualifiedErrorId : Amazon.ECR.AmazonECRException,Amazon.PowerShell.Cmdlets.ECR.GetECRLoginCommandCmdlet
Can someone please help me how to registry docker image on ECR?
Even on Windows,
it's easier to use push instructions on Linux and macOS.
you just need to install AWS CLI, docker, and set up AWS credentials.
Install AWS CLI version 2
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
To confirm the installation
C:\> aws --version
aws-cli/2.2.43 Python/3.8.8 Windows/10 exe/AMD64 prompt/off
In AWS IAM, create user with the required role.
It's not recommended. I simply created a user with AdministratorAccess.
set up your AWS credentials
aws configure
AWS Access Key ID [None]: Access Key
AWS Secret Access Key [None]: Secret Key
Default region name [None]: us-west-2
Default output format [None]: json
Now, Authenticate the docker of the Amazon ECR registry
aws ecr get-login-password | docker login --username AWS --password-stdin YOUR-REGISTRY-URL
Login Succeeded
Finally, Pushing a Docker Image
docker build -t YOUR-BUILD-NAME .
docker tag YOUR-BUILD-NAME:latest YOUR-REGISTRY-URL/YOUR-BUILD-NAME:latest
docker push YOUR-REGISTRY-URL/YOUR-BUILD-NAME:latest
Try uninstalling AWS CLI V2 and install AWS CLI V1 that fixed the problem for me.
You need to first set up you aws credentials on your Windows PC.
Separately you need to set up it for aws cli and aws sdk:
from documentation:
Credentials Store Locations
The AWS Tools for PowerShell can use either of two credentials stores:
The AWS SDK store, which encrypts your credentials and stores them in your home folder. > In Windows, this store is located at: C:\Users\username\AppData\Local\AWSToolkit\RegisteredAccounts.json.
The AWS SDK for .NET and Toolkit for Visual Studio can also use the AWS SDK store.
The shared credentials file, which is also located in your home folder, but stores credentials as plain text.
By default, the credentials file is stored here:
On Windows: C:\Users\username.aws\credentials
On Mac/Linux: ~/.aws/credentials
The AWS SDKs and the AWS Command Line Interface can also use the credentials file. If you're running a script outside of your AWS user context, be sure that the file that contains your credentials is copied to a location where all user accounts (local system and user) can access your credentials.
Example:
PS > Set-AWSCredential `
-AccessKey AKIA0123456787EXAMPLE `
-SecretKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY `
-StoreAs MyNewProfile
Source: https://docs.aws.amazon.com/powershell/latest/userguide/specifying-your-aws-credentials.html#specifying-your-aws-credentials-store
Try this
Get-AWSCredential -ListProfileDetail
If you get something like this(2 defaults)
The 1st default is causing the issue! you should remove it with the following command
Remove-AWSCredentialProfile -ProfileName default
Once you only have a single default left(the working one) Get-ECRLoginCommand should work as expected.
I had a Jenkins 2.46 installation running on an EC2 box, associated to a IAM role through an instance profile.
Jenkins was able to do various tasks requiring AWS credentials (f.e. use terraform, upload files to s3, access CodeCommit git repos) using just the instance profile role (no access key or secret keys were stored on the instance).
After upgrading to Jenkins 2.89, this is no longer the case: every task requiring authentication with AWS fails with a 403 error.
However, running a command on the instance bash as the jenkins user still works fine (f.e. running sudo -u jenkins /usr/bin/aws s3 ls s3://my-bucket/ lists bucket files; running the same command into Jenkins' Script Console yelds a 403).
I read the release notes of every version from 2.46 to 2.89 but I did not find anything relevant.
Jenkins was installed and updated through yum, the aws cli was installed using the bundled installer provided by AWS.
I am working in the US-East-1 (N.Virginia) and have even configured the Default Region Name to us-east-1 using the command aws configure.
But I am not able to access Batch using CLI. Batch is not even listed as one of the Available Services in aws help.
Any ideas how to enable Batch in AWS Cli? I have administrative access in IAM console so permissions don't seem to be the issue.
The batch service is relatively new, so its commands only exist in fairly new versions of the aws CLI.
Commands for batch in the latest cli documentation: http://docs.aws.amazon.com/cli/latest/reference/batch/index.html?highlight=batch
If you are running Windows, simply download the updated installer. https://aws.amazon.com/cli/
If you are using OSX or Linux use pip. pip install --upgrade awscli
I am following this tutorial for connecting Raspberry Pi to AWS IoT using Node.js SDK and I have done all the other steps but I am lost in the authentication and certificate step:
pi#raspberrypi:~ $ aws iot describe-endpoint
You must specify a region. You can also configure your region by running "aws configure".
pi#raspberrypi:~ $ aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:
pi#raspberrypi:~ $ ls
2016-02-24-204612_1920x1080_scrot.png Desktop get-pip.py node_modules python_games sources WiringPi
aws device.cfg ibm Pictures python-iot-raspberry-pi Templates
aws-iot-device-sdk-js Documents iot_1.0-1_armhf.deb projects root Videos
certs Downloads Music Public root.pem wiringPi
pi#raspberrypi:~ $ cd certs/
pi#raspberrypi:~/certs $ ls
1cf77402f9-certificate.pem.crt 1cf77402f9-private.pem.key 1cf77402f9-public.pem.key
When I browse to https://A34SXNTM6AT7XH.iot.us-west-2.amazonaws.com/things/MyNewThing/shadow or https://A34SXNTM6AT7XH.iot.us-west-2.amazonaws.com I see Missing Authentication Token message:
I am not sure how to get the last step working so I could see stuff in the URLs when I browse to them. Can someone help me figure which steps I am missing or is missing from the tutorial?
This fixed the problem:
Browse to
https://console.aws.amazon.com/iam/home?region=us-west-2#security_credential
and then if you don’t have a key click on create new access key and
if you already have it save the information and enter it in front of
entries of aws configure command and also for region select
“us-west-2” is Oregon is selected in your dashboard.
After that you will be able to see the credential in the following:
The AWS credentials file – located at ~/.aws/credentials on Linux, OS
X, or Unix