@@ -40,6 +40,7 @@ function usage {
4040 echo " * Use additional (-s) in <sourceIdentifier>:<sourceLocation> format for secondary source"
4141 echo " * For sourceIdentifier, use a value that is fewer than 128 characters and contains only alphanumeric characters and underscores"
4242 echo " -c Use the AWS configuration and credentials from your local host. This includes ~/.aws and any AWS_* environment variables."
43+ echo " -p Used to specify the AWS CLI Profile."
4344 echo " -b FILE Used to specify a buildspec override file. Defaults to buildspec.yml in the source directory."
4445 echo " -m Used to mount the source directory to the customer build container directly."
4546 echo " -e FILE Used to specify a file containing environment variables."
@@ -57,7 +58,7 @@ artifact_flag=false
5758awsconfig_flag=false
5859mount_src_dir_flag=false
5960
60- while getopts " cmi:a:s:b:e:l:h" opt; do
61+ while getopts " cmi:a:s:b:e:l:p: h" opt; do
6162 case $opt in
6263 i ) image_flag=true; image_name=$OPTARG ;;
6364 a ) artifact_flag=true; artifact_dir=$OPTARG ;;
@@ -67,6 +68,7 @@ while getopts "cmi:a:s:b:e:l:h" opt; do
6768 s ) source_dirs+=(" $OPTARG " );;
6869 e ) environment_variable_file=$OPTARG ;;
6970 l ) local_agent_image=$OPTARG ;;
71+ p ) aws_profile=$OPTARG ;;
7072 h ) usage; exit ;;
7173 \? ) echo " Unknown option: -$OPTARG " >&2 ; exit 1;;
7274 : ) echo " Missing option argument for -$OPTARG " >&2 ; exit 1;;
@@ -144,6 +146,12 @@ then
144146 else
145147 docker_command+=" -e \" AWS_CONFIGURATION=NONE\" "
146148 fi
149+
150+ if [ -n " $aws_profile " ]
151+ then
152+ docker_command+=" -e \" AWS_PROFILE=$aws_profile \" "
153+ fi
154+
147155 docker_command+=" $( env | grep ^AWS_ | while read -r line; do echo " -e \" $line \" " ; done ) "
148156fi
149157
0 commit comments