Create an AWS policy with S3 access rights (in particular PutObject
, GetObject
etc.)
Create an EC2 oriented IAM role and add the policy from the first step to that role
Assign the IAM role to the EC2 instance (or perhaps configure it to use in an instance profile when creating EC2 instances for your cluster)
Now you are ready to do your work in Julia. Below a simple example that serializes and deserializes any Julia object to an S3 bucket.
using AWS, AWSS3, Serialization
struct SampleData
a::Int
b::String
end
d=SampleData(1,"sss")
aws = global_aws_config(; region="us-east-1")
b = IOBuffer()
serialize(b, d)
s3_put(aws, "your-s3-bucket-name","myfile.bin", b.data)
ddat = s3_get(aws, "your-s3-bucket-name","myfile.bin")
d2 = deserialize(IOBuffer(ddat))
@assert d == d2
Should you have any problems with points 1-3, here is the tutorial: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-instance-access-s3-bucket/