Using s3bucket Properties
The simplest way to initialize the s3bucket with your S3 bucket's URL and access credentials is by directly setting properties of the s3bucket object within the model. For example:
model DirectInitExample uses "s3" declarations mybucket: s3bucket end-declarations mybucket.url := "https://s3-us-west-2.amazonaws.com/nameofmybucket/" mybucket.region := "us-west-2" mybucket.keyprefix := "myprefix/" ! Optional mybucket.accesskeyid := "JKHGDMNAYGWEnbbsJGDI" mybucket.secretkey := "jhdfusJasfui;SVFYSIAVS++siufgsuUISNISOWJ" mybucket.sessiontoken := "kHUFGBSUjbfusbuioUHDFSIngudblincxubhxop0szofbv" ! Optional ! mybucket now initialized and can be used end-model
The Bucket URL, Region, Access Key ID and Secret Key must always be specified. If the credentials you are given include a Session Token (sometimes referred to as a Security Token), then you must also specify this. Giving a Key Prefix is optional.
Note that the S3 credentials will not be verified until you make a request to the S3 service. The values you give for the url, region and keyprefix can be read back out of the s3bucket, but for security reasons the accesskeyid, secretkey and sessiontoken properties may not be read.
If you are using server-side encryption with AWS-managed keys, you can configure this by setting additional fields on the s3bucket object, as follows:
mybucket.sse := "aws:kms" mybucket.ssekmskeyid := "keyid" ! Replace 'keyid' with ID of yourkey in the AWS key management service mybucket.ssecontext := "x=1" ! Encryption context; optional