Showing posts with label cli. Show all posts
Showing posts with label cli. Show all posts

Elastic BeanStalk command line usage create application, create environment, deploy, terminate, git branch

Elastic BeanStalk 
#create elastic bean stalk applicaiton
eb init
#create elastic bean stalk environment for current applicaiton
eb create

#push current branch the code to current default environment of current applicaiton
eb deploy

# list environment for the current application
eb list

#set default environment name for git branch
eb use

#connect to ec2 instace
eb ssh
#show slogs
eb logs


#open amazon console of elasticbean for this application
eb console

#check environment health
eb health

#sets environment variable of the current environment, current applicaton
eb setenv name="ikbhal" age=20

#print the enviroment variable of the current enviromnet, current application
eb printenv

#status of the environment
eb status
status: updating, terminating
health: Grey, Green

#terminate the environment
eb terminate

#list all the git branch
git branch

#change the git branch
git chekcout

#delete the git branch
git branch -d
note: you can not delete the current branch

#to force delte git branch
git branch -D


#merge to master
git checkout master
git merge

Install AWS cli(command line) on mac?

reference: http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-bundle-other-os

Requirement:
2.6.5+ or 3.3+

sudo pip install awscli

to upgrade
suod pip install --upgrade awscli

How to create AWS instance profile via command line?

1)Create instance profile
aws iam create-instance-profile

2)Attach role to instance profile
aws iam add-role-to-instance-profile

# Create the role and attach the trust policy that enables EC2 to assume this role.
aws iam create-role --role-name Test-Role-for-EC2 --assume-role-policy-document file://C:\policies\trustpolicyforec2.json

# Embed the permissions policy (in this example an inline policy) to the role to specify what it is allowed to do.
aws iam put-role-policy --role-name Test-Role-for-EC2 --policy-name Permissions-Policy-For-Ec2 --policy-document file://c:\policies\permissionspolicyforec2.json

# Create the instance profile required by EC2 to contain the role
aws iam create-instance-profile --instance-profile-name EC2-ListBucket-S3

# Finally, add the role to the instance profile
aws iam add-role-to-instance-profile --instance-profile-name EC2-ListBucket-S3 --role-name Test-Role-for-EC2