以下是我正在尝试使用Ruby在AWS中进行的操作
到目前为止,我能够完成第1步和第2步。我陷入了第3步。想知道如何继续执行此步骤?
require 'aws-sdk'
require 'aws-sdk-s3'
# conn = Athens::Connection.new(region: 'ap-southeast-2')
athena = Aws::Athena::Client.new(region: 'ap-southeast-2')
response = athena.start_query_execution({
query_string: "Select * from test_table",
query_execution_context: {
database: "test_database",
},
result_configuration: {
output_location: "s3://test",
encryption_configuration: {
encryption_option: "SSE_S3", # required, accepts SSE_S3, SSE_KMS, CSE_KMS
kms_key: "String",
},
},
work_group: "primary"
})
puts response[:query_execution_id]
sleep(300)
file = response[:query_execution_id]+ ".csv"
puts file.class
s3 = Aws:: S3:: Resource.new(region: 'ap-southeast-2')
bucket_exists = s3.bucket('test').exists ?
puts bucket_exists
bucket = s3.bucket('badariathena')
if bucket.object(file).exists ?
puts "File present"
else
puts "File not present"
end