You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`AWS_CODE_DEPLOY_KEY`| No | If specified, sets the AWS key id |
106
+
|`AWS_CODE_DEPLOY_SECRET`| No | If specified, sets the AWS secret key |
107
+
|`AWS_CODE_DEPLOY_REGION`| No | If specified, sets the AWS region |
108
+
|`AWS_CODE_DEPLOY_APPLICATION_NAME`|**Yes**| Application name. If it does not exist, will create. |
109
+
|`AWS_CODE_DEPLOY_DEPLOYMENT_GROUP_NAME`|**Yes**| Deployment group name. If it does not exist, will create. |
110
+
|`AWS_CODE_DEPLOY_DEPLOYMENT_CONFIG_NAME`| No | Deployment config name. By default: _CodeDeployDefault.OneAtATime_|
111
+
|`AWS_CODE_DEPLOY_MINIMUM_HEALTHY_HOSTS`| No | The minimum number of healthy instances during deployment. By default: _type=FLEET_PERCENT,value=75_|
112
+
|`AWS_CODE_DEPLOY_SERVICE_ROLE_ARN`| No | Service role arn giving permissions to use Code Deploy when creating a deployment group |
113
+
|`AWS_CODE_DEPLOY_EC2_TAG_FILTERS`| No | EC2 tags to filter on when creating a deployment group |
114
+
|`AWS_CODE_DEPLOY_AUTO_SCALING_GROUPS`| No | Auto Scaling groups when creating a deployment group |
115
+
|`AWS_CODE_DEPLOY_APP_SOURCE`|**Yes**| The source directory used to create the deploy archive |
116
+
|`AWS_CODE_DEPLOY_S3_BUCKET`|**Yes**| The name of the S3 bucket to deploy the revision |
117
+
|`AWS_CODE_DEPLOY_S3_KEY_PREFIX`| No | A prefix to use for the revision bucket key |
118
+
|`AWS_CODE_DEPLOY_S3_FILENAME`|**Yes**| The destination name within S3. |
119
+
|`AWS_CODE_DEPLOY_S3_LIMIT_BUCKET_FILES`| No | Number of revisions to limit. If 0, unlimited. By default: 0 |
120
+
|`AWS_CODE_DEPLOY_S3_SSE`| No | If specified and `true` will ensure the CodeDeploy archive is stored in S3 with Server Side Encryption (SSE) |
121
+
|`AWS_CODE_DEPLOY_REVISION_DESCRIPTION`| No | A description that is stored within AWS Code Deploy that stores information about the specific revision |
122
+
|`AWS_CODE_DEPLOY_DEPLOYMENT_DESCRIPTION`| No | A description that is stored within AWS Code Deploy that stores information about the specific deployment |
99
123
100
-
```
101
-
AWS_CODE_DEPLOY_KEY
102
-
AWS_CODE_DEPLOY_SECRET
103
-
AWS_CODE_DEPLOY_REGION
104
-
AWS_CODE_DEPLOY_APPLICATION_NAME
105
-
AWS_CODE_DEPLOY_DEPLOYMENT_CONFIG_NAME
106
-
AWS_CODE_DEPLOY_MINIMUM_HEALTHY_HOSTS
107
-
AWS_CODE_DEPLOY_DEPLOYMENT_GROUP_NAME
108
-
AWS_CODE_DEPLOY_SERVICE_ROLE_ARN
109
-
AWS_CODE_DEPLOY_EC2_TAG_FILTERS
110
-
AWS_CODE_DEPLOY_AUTO_SCALING_GROUPS
111
-
AWS_CODE_DEPLOY_APP_SOURCE
112
-
AWS_CODE_DEPLOY_S3_BUCKET
113
-
AWS_CODE_DEPLOY_S3_KEY_PREFIX
114
-
AWS_CODE_DEPLOY_S3_FILENAME
115
-
AWS_CODE_DEPLOY_S3_LIMIT_BUCKET_FILES
116
-
AWS_CODE_DEPLOY_S3_SSE
117
-
AWS_CODE_DEPLOY_REVISION_DESCRIPTION
118
-
AWS_CODE_DEPLOY_DEPLOYMENT_DESCRIPTION
119
-
```
120
124
121
125
## Examples
122
126
@@ -291,7 +295,7 @@ This step ensures the deployment group exists within the specified application.
291
295
Environment Variables:
292
296
293
297
*`AWS_CODE_DEPLOY_DEPLOYMENT_GROUP_NAME` (required): Deployment group name
294
-
*`AWS_CODE_DEPLOY_SERVICE_ROLE_ARN` (required): Service role arn giving permissions to use Code Deploy when creating a deployment group
298
+
*`AWS_CODE_DEPLOY_SERVICE_ROLE_ARN` (optional): Service role arn giving permissions to use Code Deploy when creating a deployment group
295
299
*`AWS_CODE_DEPLOY_EC2_TAG_FILTERS` (optional): EC2 tags to filter on when creating a deployment group. Specify as a string with the following comma separated keys:
296
300
***Key***string*
297
301
***Value***string*
@@ -323,7 +327,7 @@ This step consists to push the application to S3.
323
327
Environment Variables:
324
328
325
329
*`AWS_CODE_DEPLOY_S3_BUCKET` (required): The name of the S3 bucket to deploy the revision
326
-
*`AWS_CODE_DEPLOY_S3_KEY_PREFIX` (optional): A prefix to use for the file key. It's highly recommended to structure a bucket with a prefix per deployment group. This allows to limit stored revisions per deployment group. Note: A leading or trailing slash is not required.
330
+
*`AWS_CODE_DEPLOY_S3_KEY_PREFIX` (optional): A prefix to use for the file key. It's highly recommended to structure a bucket with a prefix per deployment group. This allows to limit stored revisions per deployment group. Note: A leading or trailing slash is not required.
Copy file name to clipboardExpand all lines: bin/aws-code-deploy.sh
+15-22
Original file line number
Diff line number
Diff line change
@@ -181,45 +181,38 @@ fi
181
181
182
182
h1 "Step 2: Configuring AWS"
183
183
if [ -z"$AWS_CODE_DEPLOY_KEY" ];then
184
-
if [ !-e~/.aws/config ];then
185
-
error "Please configure AWS credentials or explicitly set the \"\$AWS_CODE_DEPLOY_KEY\" variable"
186
-
exit 1
187
-
fi
188
-
if [ $(grep aws_access_key_id ~/.aws/config | wc -l)-lt 1 ];then
189
-
error "Unable to find \"aws_access_key_id\" in ~/.aws/config. Please configure AWS credentials or explicitly set the \"\$AWS_CODE_DEPLOY_KEY\" variable"
184
+
# Ensure an access key has already been set
185
+
if [ $(aws configure list | grep access_key | wc -l)-lt 1 ];then
186
+
error "No AWS_CODE_DEPLOY_KEY specified and AWS cli is not configured with an access key via env, config, or shared credentials"
190
187
exit 1
191
188
fi
192
189
success "AWS Access Key already configured."
193
190
else
194
-
CONFIGURE_KEY_OUTPUT=$(aws configure set aws_access_key_id $AWS_CODE_DEPLOY_KEY2>&1)
191
+
$(aws configure set aws_access_key_id $AWS_CODE_DEPLOY_KEY2>&1)
error "Please configure AWS credentials or explicitly set the \"\$AWS_CODE_DEPLOY_SECRET\" variable"
201
-
exit 1
202
-
fi
203
-
if [ $(grep aws_secret_access_key ~/.aws/config | wc -l)-lt 1 ];then
204
-
error "Unable to find \"aws_secret_access_key\" in ~/.aws/config. Please configure AWS credentials or explicitly set the \"\$AWS_CODE_DEPLOY_SECRET\" variable"
196
+
# Ensure an access key secret has already been set
197
+
if [ $(aws configure list | grep secret_key | wc -l)-lt 1 ];then
198
+
error "No AWS_CODE_DEPLOY_SECRET specified and AWS cli is not configured with an access secret via env, config, or shared credentials"
0 commit comments