Hi Community,
How do I configure my app.rb file to correctly create and connect to S3 using LocalStack as my testing platform? Thank you.
I have been testing with the following configs:
require 'aws-sdk-s3'
region = "eu-west-1"
# Aws.config.update(
# endpoint: 'http://s3.localhost.localstack.cloud:4566', # update with localstack endpoint
# access_key_id: 'fake', # update with localstack credentials
# secret_access_key: 'fake', # update with localstack credentials
# region: region,
# force_path_style: true, # Enable 'force_path_style' => true, if bucket name is non DNS compliant
# )
# Aws.config.update(
# endpoint: 'http://s3.localhost.localstack.cloud:4566', # update with localstack endpoint
# credentials: Aws::Credentials.new('fake', 'fake'),
# region: region,
# force_path_style: true,
# )
# # Create an S3 client with custom endpoint and force path style
s3 = Aws::S3::Client.new(
endpoint: 'http://s3.localhost.localstack.cloud:4566', # update with localstack endpoint
region: region,
access_key_id: 'fake', # update with localstack credentials
secret_access_key: 'fake', # update with localstack credentials
force_path_style: true # Enable force path style
)
# Docs: https://terraspace.cloud/docs/config/reference/
Terraspace.configure do |config|
config.logger.level = :info
# copy_modules setting introduced 2.2.5 to speed up terraspace build
# See: https://terraspace.cloud/docs/config/reference
config.build.copy_modules = true
#config.build.cache_dir = ":APP/:ROLE/:ENV/:BUILD_DIR" # without :REGION
#endpoint: 'http://localhost:4572',
#credentials: Aws::Credentials.new('fake', 'fake'),
#region: 'us-east-1',
#force_path_style: true,
end