-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaws.sh
48 lines (45 loc) · 1.24 KB
/
aws.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
complete -C "${PYTHON_INSTALL_PATH}/aws_completer" aws
ecr-login() {
REGION=${AWS_DEFAULT_REGION:-us-east-1}
ACCOUNT_ID=${ACCOUNT_ID:-485185227295}
while [ "$1" ]; do
case $1 in
--region )
shift
REGION=$1
;;
-i | --id | --account-id )
shift
ACCOUNT_ID=$1
;;
* )
echo "Error: Unknown arg $1"
return 1
;;
esac
shift
done
aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com
}
ecr-public-login() {
REGION=${REGION:-us-east-1}
REGISTRY=${REGISTRY:-public.ecr.aws/m0z8a6o8}
while [ "$1" ]; do
case $1 in
--region )
shift
REGION=$1
;;
--registry )
shift
REGISTRY=$1
;;
* )
echo "Error: Unknown arg $1"
return 1
;;
esac
shift
done
aws ecr-public get-login-password --region ${REGION} | docker login --username AWS --password-stdin ${REGISTRY}
}