Do I have to install AWS CLI in each server? - amazon-web-services

I have multiple standalone servers from where I want to upload/sync directories to Object Storage usign AWS CLI.
Do I have to install AWS CLI in each server? OR is there a common console/platform provided within AWS Object Storage from where I can call the same command over something like say SSH. How can I avoid installing cli to all the servers?

You have to install AWS CLI in all the servers even if you write the script to ssh from a single server that which is installed AWS CLI, SSH protocol will take the configuration from the remote server, not from a server where the script is running. It's better if you use a configuration management tool like ansible to speed up the process.

Related

Deploy Springboot jar to aws ec2 instance using jenkins from local machine

I am new to Jenkins and want to deploy my jar file to AWS ec2. I know how to do it manually, but I want to use Jenkins from a local machine.
I have set up Jenkins on local and I am able to transfer my jar from local to AWS ec2 instance using SCP. I want to know how to trigger run this jar.
or I have also tried using AWS CLI plugin which is connecting me to aws from Jenkins as well but I don't have any clue how should proceed further to deploy an application.

Limit Upload bandwidth for S3 sync with ansible

AWS provides a config to limit the upload bandwidth when copying files to s3 from ec2 instances. This can be configured by below AWS config.
aws configure set default.s3.max_bandwidth
Once we set this config and run an AWS CLI command to cp files to s3 bandwidth is limited.
But when I run the s3_sync ansible module on the same ec2 instance that limitation is not getting applied. Any possible workaround to apply the limitation to ansible as well?
Not sure if this is possible because botocore may not support this.
Mostly is up to Amazon to fix their python API.
For example Docker module works fine by sharing confugration between cli and python-api.
Obviously that I assumed you did run this command locally as the same user because otherwise the aws config you made would clearly not be used.

How to install aws cli inside jailshell

I have some files stored in a bucket on AWS S3 which I would like to access from a PHP application running on a remote webserver. Unfortunately I am having troubling installing aws cli on the remote webserver as my hosting company has constrained me within jailshell, so I can't run any install scripts; I have no ssh access and can only upload software to the remote web server via FTP. I can run scripts on the remote web server via cron jobs so I can do some automated execution within the jailshell but it's pretty limited
I tried doing an installation on my local machine with the awscli bundled installer, which limited the installation to a single directory /aws on my local machine, which I then uploaded to the remote webserver, but I ran into problems executing the aws commands from a script due to symlinks and PATH not set up correctly on the remote webserver.
http://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html
explains how to set up the aws cli, but it doesn't work well in my situation where I can't run PIP, or even edit the $PATH.

Remote update ec2 instance with docker image

I have a release of my project. I build a docker image and deploy it on an ec2 instance.
Later, when I have a new release, I would like update the docker on ec2 remotely (without accessing the machine, just executing some service).
Is there a way how to do it without ECS and ElasticBeanstalk?
If it's not possible can I somehow re-run the cfn-init script?
My Research
https://aws.amazon.com/blogs/aws/new-ec2-run-command-remote-instance-management-at-scale/
You can manage your instances remotely (i.e. make changes without manually SSHing into the instance and typing commands) by using any of the many system management services out there. AWS offers Simple Systems Manager (SSM) of which the Run Command you linked is part. AWS also offers the OpsWorks service which uses Chef. You also have other products like Ansible and SaltStack, and you can optionally integrate the use of those services with the AWS SSM service.

Amazon EC2 Instance - Where to add the credentials file?

I have an Amazon EC2 Instance. On my Instance I want to run a python program. The program tries to access other amazon services. On my Mac the program worked fine, because the credentials file is in the folder "~/.aws/credentials". But I don't know where on my amazon EC2 instance the library "~" is. So where do I have to put my credentials? Hope you can help me.
~ is a shortcut for your home directory. Just go into that directory using the command cd ~. This is the directory you will always start in when you SSH into your server.
Alternatively you could install the AWS CLI and run aws configure. If you are using Amazon Linux then the AWS CLI tool is already installed.
Also, storing credentials on your EC2 instance is not the preferred method. You should look into using EC2 instance profiles.