AWS Elastic Beanstalk from Command Line
Lets take a sample python based application and deploy this into elastic beanstalk
I would like to deploy from command line
Setting up AWS CLI
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
Ubuntu Linux:
Lets create the keypair with pem file
Create ec2 instance with size t2.micro with key pair created above
Now ensure you have Windows Powershell (latest update on Windows 10/Windows 11). If you are working on earlier versions of windows ensure atlest gitbash is installed. Refer Here
For Mac users => Launch Terminal
The command to login ssh -i <path to pem> ubuntu@<publicip>
Installing AWS CLI on ubuntu:
sudo apt update
sudo apt install unzip -y
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Now verify the installation using aws --version
Now create an IAM user Refer Here
Login into ec2 instance and execute aws configure. Enter access key, secret access key, region (us-west-2)
Now we need to verify access aws s3 ls this command should not throw error
Now we need to install elastic beanstalk cli eb-cli
Approach 1 Refer Here
Approach 2 Refer Here
sudo apt install python3-pip -y
Now install eb-cli pip install awsebcli --upgrade --user
Now we need to set the path
Add export PATH=~/.local/bin:$PATH to ~/.bashrc
Now logout and login eb --version
New to linux: Understand the following
sudo
apt
PATH variable and its importance
vi editor