Skip to main content

AWS - S3

This Integration is part of the AWS - S3 Pack.#

Amazon Web Services Simple Storage Service (S3).

This integration was integrated and tested with API Version 2012-11-05.

For detailed instructions about setting up authentication, see: AWS Integrations - Authentication.

Configure AWS - S3 in Cortex#

ParameterDescriptionRequired
roleArnRole ArnFalse
roleSessionNameRole Session NameFalse
defaultRegionAWS Default RegionFalse
sessionDurationRole Session DurationFalse
access_keyAccess KeyFalse
secret_keySecret KeyFalse
timeoutThe time in seconds till a timeout exception is reached. You can specify just the read timeout (for example 60) or also the connect timeout followed after a comma (for example 60,10). If a connect timeout is not specified, a default of 10 second will be used.False
retriesThe maximum number of retry attempts when connection or throttling errors are encountered. Set to 0 to disable retries. The default value is 5 and the limit is 10. Note: Increasing the number of retries will increase the execution time.False
insecureTrust any certificate (not secure)False
proxyUse system proxy settingsFalse

Commands#

You can execute these commands from the CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.

aws-s3-create-bucket#


Create AWS S3 bucket.

Base Command#

aws-s3-create-bucket

Input#

Argument NameDescriptionRequired
bucketThe name of S3 bucket to create (in lowercase).Required
aclACL for S3 bucket. Possible values are: private, public-read, public-read-write, authenticated-read.Optional
locationConstraintSpecifies the region where the bucket will be created. If you don't specify a region, the bucket will be created in US Standard.Optional
grantFullControlAllows grantee the read, write, read ACP, and write ACP permissions on the bucket.Optional
grantReadAllows grantee to list the objects in the bucket.Optional
grantReadACPAllows grantee to read the bucket ACL.Optional
grantWriteAllows grantee to create, overwrite, and delete any object in the bucket.Optional
grantWriteACPAllows grantee to write the ACL for the applicable bucket.Optional
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

PathTypeDescription
AWS.S3.Buckets.BucketNamestringThe name of the bucket that was created.
AWS.S3.Buckets.LocationstringThe AWS Region the bucket was created.

Command Example#

!aws-s3-create-bucket bucket=test acl=private

Human Readable Output#

AWS S3 Buckets

BucketNameLocation
testtest

aws-s3-delete-bucket#


Delete AWS S3 bucket.

Base Command#

aws-s3-delete-bucket

Input#

Argument NameDescriptionRequired
bucketName of S3 bucket to delete.Required
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

There is no context output for this command.

Command Example#

!aws-s3-delete-bucket bucket=test

Human Readable Output#

The bucket was deleted.

aws-s3-list-buckets#


List all S3 buckets in AWS account

Base Command#

aws-s3-list-buckets

Input#

Argument NameDescriptionRequired
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

PathTypeDescription
AWS.S3.Buckets.BucketNamestringThe name of the bucket.
AWS.S3.Buckets.CreationDatedateDate the bucket was created.

Command Example#

!aws-s3-list-buckets

Human Readable Output#

AWS S3 Buckets

BucketNameCreationDate
backup-lab2018-04-29T13:31:57
test2018-05-06T06:34:30

aws-s3-get-bucket-policy#


Get AWS S3 Bucket Policy

Base Command#

aws-s3-get-bucket-policy

Input#

Argument NameDescriptionRequired
bucketName of bucket.Required
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

PathTypeDescription
AWS.S3.Buckets.Policy.VersionstringS3 Bucket Policy Version.
AWS.S3.Buckets.Policy.PolicyIdstringS3 Bucket Policy ID.
AWS.S3.Buckets.Policy.SidstringS3 Bucket Policy Statment ID.
AWS.S3.Buckets.Policy.ActionstringS3 Bucket Policy Statment Action.
AWS.S3.Buckets.Policy.PrincipalstringS3 Bucket Policy Statment Principal.
AWS.S3.Buckets.Policy.ResourcestringS3 Bucket Policy Statment Resource.
AWS.S3.Buckets.Policy.EffectstringS3 Bucket Policy Statment Effect.
AWS.S3.Buckets.Policy.JsonstringAWS S3 Policy Json output.
AWS.S3.Buckets.Policy.BucketNamestringS3 Bucket Name.

Command Example#

!aws-s3-get-bucket-policy bucket=test

aws-s3-delete-bucket-policy#


Deletes the policy from the bucket.

Base Command#

aws-s3-delete-bucket-policy

Input#

Argument NameDescriptionRequired
bucketName of S3 bucket.Required
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

There is no context output for this command.

Command Example#

!aws-s3-delete-bucket-policy bucket=test

Human Readable Output#

Policy deleted from test.

aws-s3-download-file#


Download a file from S3 bucket to war room.

Base Command#

aws-s3-download-file

Input#

Argument NameDescriptionRequired
bucketThe name of S3 bucket.Optional
keyThe S3 object key to download.Optional
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

There is no context output for this command.

Command Example#

!aws-s3-download-file bucket=test key=test.txt

aws-s3-list-bucket-objects#


List object in S3 bucket.

Base Command#

aws-s3-list-bucket-objects

Input#

Argument NameDescriptionRequired
bucketThe name of S3 bucket.Required
prefixLimits the response to keys that begin with the specified prefix.Optional
delimiterA delimiter is a character you use to group keys.Optional
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

PathTypeDescription
AWS.S3.Buckets.Objects.KeyUnknownThe name of S3 object.
AWS.S3.Buckets.Objects.SizeUnknownObject size.
AWS.S3.Buckets.Objects.LastModifiedUnknownLast date object was modified.

Command Example#

!aws-s3-list-bucket-objects bucket=test prefix=testing delimiter='/'

Human Readable Output#

AWS S3 Bucket Objects

KeySizeLastModified
demi2018-04-05-14-29-49-76DA472F25CB951F323.0 B2018-04-05T14:29:51

aws-s3-put-bucket-policy#


Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it.

Base Command#

aws-s3-put-bucket-policy

Input#

Argument NameDescriptionRequired
bucketName of S3 bucket.Required
policyThe bucket policy to apply in json format.Required
confirmRemoveSelfBucketAccessSet this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future. Possible values are: True, False.Optional
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

There is no context output for this command.

Command Example#

!aws-s3-put-bucket-policy bucket=test policy={"Version":"2012-10-17","Id":"Policy1519481415511","Statement":[{"Sid":"Stmt1519ds34548138sf5929","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::123456789:user/itai"},"Action":"s3:","Resource":"arn:aws:s3:::test"},{"Sid":"Stmt1345519481414395","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::123456789:user/bob"},"Action":"s3:","Resource":"arn:aws:s3:::test"}]}

Human Readable Output#

Successfully applied bucket policy to test bucket.

aws-s3-upload-file#


Upload file to S3 bucket

Base Command#

aws-s3-upload-file

Input#

Argument NameDescriptionRequired
entryIDEntry ID of the file to upload.Required
bucketThe name of the bucket to upload to.Required
keyThe name of the key to upload to.Required
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

There is no context output for this command.

Command Example#

!aws-s3-upload-file bucket="bucket name" key="file name to be displayed" entryID=##@##

Human Readable Output#

File {file name to be displayed} was uploaded successfully to {bucket name}'

aws-s3-get-public-access-block#


Retrieves the PublicAccessBlock configuration for an Amazon S3 bucket.

Base Command#

aws-s3-get-public-access-block

Input#

Argument NameDescriptionRequired
bucketThe name of the Amazon S3 bucket whose PublicAccessBlock configuration you want to retrieve.Required
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

PathTypeDescription
AWS.S3.Buckets.BucketName.PublicAccessBlockConfiguration.BlockPublicAclsBooleanSpecifies whether Amazon S3 should block public access control lists (ACLs) for this bucket and objects in this bucket.
AWS.S3.Buckets.BucketName.PublicAccessBlockConfiguration.IgnorePublicAclsBooleanSpecifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket.
AWS.S3.Buckets.BucketName.PublicAccessBlockConfiguration.BlockPublicPolicyBooleanSpecifies whether Amazon S3 should block public bucket policies for this bucket.
AWS.S3.Buckets.BucketName.PublicAccessBlockConfiguration.RestrictPublicBucketsBooleanSpecifies whether Amazon S3 should restrict public bucket policies for this bucket.

Command Example#

!aws-s3-get-public-access-block bucket="bucket name"

Human Readable Output#

AWS S3 Bucket Public Access Block

BlockPublicAclsIgnorePublicAclsBlockPublicPolicyRestrictPublicBuckets
TrueFalseTrueFalse

aws-s3-put-public-access-block#


Creates or modifies the PublicAccessBlock configuration for an Amazon S3 bucket.

Base Command#

aws-s3-put-public-access-block

Input#

Argument NameDescriptionRequired
bucketThe name of the bucket to upload to.Required
BlockPublicAclsSpecifies whether Amazon S3 should block public access control lists (ACLs) for this bucket and objects in this bucket.Required
IgnorePublicAclsSpecifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket.Required
BlockPublicPolicySpecifies whether Amazon S3 should block public bucket policies for this bucket.Required
RestrictPublicBucketsSpecifies whether Amazon S3 should restrict public bucket policies for this bucket.Required
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

There is no context output for this command.

Command Example#

!aws-s3-put-public-access-block bucket="bucket name" BlockPublicAcls=True IgnorePublicAcls=False BlockPublicPolicy=True RestrictPublicBuckets=True

Human Readable Output#

Successfully applied public access block to the {bucket} bucket.

aws-s3-get-bucket-encryption#


Get AWS S3 Bucket Encryption

Base Command#

aws-s3-get-bucket-encryption

Input#

Argument NameDescriptionRequired
bucketThe name of the bucket from which the server-side encryption configuration is retrieved.Required
expectedBucketOwnerThe account ID of the exepcted bucket owner.Optional
regionThe AWS Region, if not specified the default region will be used.Optional
roleArnThe Amazon Resource Name (ARN) of the role to assume.Optional
roleSessionNameAn identifier for the assumed role session.Optional
roleSessionDurationThe duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role.Optional

Context Output#

PathTypeDescription
AWS.S3.Buckets.BucketName.ServerSideEncryptionConfiguration.Rules.ApplyServerSideEncryptionByDefault.SSEAlgorithmStringS3 Bucket Encryption SSE Algorithm.
AWS.S3.Buckets.BucketName.ServerSideEncryptionConfiguration.Rules.ApplyServerSideEncryptionByDefault.KMSMasterKeyIDStringS3 Bucket Encryption KMS Master Key ID.
AWS.S3.Buckets.BucketName.ServerSideEncryptionConfiguration.Rules.BucketKeyEnabledBooleanS3 Bucket Encryption Key Enabled.

Command Example#

!aws-s3-put-public-access-block bucket="bucket name" BlockPublicAcls=True IgnorePublicAcls=False BlockPublicPolicy=True RestrictPublicBuckets=True

Context Example#

{
"AWS": {
"S3": {
"Buckets": [
{
"BucketName": "bucket-a",
"ServerSideEncryptionConfiguration": {
"Rules": [
{
"ApplyServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
}
}
]
}
}
]
}
}
}