Module: Aws

Defined in:
lib/aws-sdk-core.rb,
lib/aws-sdk-core/s3.rb,
lib/aws-sdk-core/rds.rb,
lib/aws-sdk-core/json.rb,
lib/aws-sdk-core/pager.rb,
lib/aws-sdk-core/polly.rb,
lib/aws-sdk-core/client.rb,
lib/aws-sdk-core/errors.rb,
lib/aws-sdk-core/service.rb,
lib/aws-sdk-core/version.rb,
lib/aws-sdk-core/dynamodb.rb,
lib/aws-sdk-core/checksums.rb,
lib/aws-sdk-core/structure.rb,
lib/aws-sdk-core/tree_hash.rb,
lib/aws-sdk-core/cloudfront.rb,
lib/aws-sdk-core/ini_parser.rb,
lib/aws-sdk-core/partitions.rb,
lib/aws-sdk-core/signers/s3.rb,
lib/aws-sdk-core/signers/v2.rb,
lib/aws-sdk-core/signers/v3.rb,
lib/aws-sdk-core/signers/v4.rb,
lib/aws-sdk-core/xml/parser.rb,
lib/aws-sdk-core/api/builder.rb,
lib/aws-sdk-core/credentials.rb,
lib/aws-sdk-core/json/parser.rb,
lib/aws-sdk-core/query/param.rb,
lib/aws-sdk-core/xml/builder.rb,
lib/aws-sdk-core/client_stubs.rb,
lib/aws-sdk-core/deprecations.rb,
lib/aws-sdk-core/eager_loader.rb,
lib/aws-sdk-core/json/builder.rb,
lib/aws-sdk-core/json/handler.rb,
lib/aws-sdk-core/rest/handler.rb,
lib/aws-sdk-core/s3/presigner.rb,
lib/aws-sdk-core/signers/base.rb,
lib/aws-sdk-core/type_builder.rb,
lib/aws-sdk-core/api/shape_map.rb,
lib/aws-sdk-core/log/formatter.rb,
lib/aws-sdk-core/query/handler.rb,
lib/aws-sdk-core/shared_config.rb,
lib/aws-sdk-core/api/docs/utils.rb,
lib/aws-sdk-core/client_waiters.rb,
lib/aws-sdk-core/endpoint_cache.rb,
lib/aws-sdk-core/json/oj_engine.rb,
lib/aws-sdk-core/waiters/errors.rb,
lib/aws-sdk-core/waiters/poller.rb,
lib/aws-sdk-core/waiters/waiter.rb,
lib/aws-sdk-core/ecs_credentials.rb,
lib/aws-sdk-core/empty_structure.rb,
lib/aws-sdk-core/param_converter.rb,
lib/aws-sdk-core/param_validator.rb,
lib/aws-sdk-core/plugins/logging.rb,
lib/aws-sdk-core/plugins/s3_md5s.rb,
lib/aws-sdk-core/polly/presigner.rb,
lib/aws-sdk-core/xml/default_map.rb,
lib/aws-sdk-core/xml/doc_builder.rb,
lib/aws-sdk-core/api/docs/builder.rb,
lib/aws-sdk-core/json/json_engine.rb,
lib/aws-sdk-core/log/param_filter.rb,
lib/aws-sdk-core/plugins/sqs_md5s.rb,
lib/aws-sdk-core/query/param_list.rb,
lib/aws-sdk-core/waiters/provider.rb,
lib/aws-sdk-core/xml/default_list.rb,
lib/aws-sdk-core/xml/parser/frame.rb,
lib/aws-sdk-core/xml/parser/stack.rb,
lib/aws-sdk-core/cloudfront/signer.rb,
lib/aws-sdk-core/endpoint_provider.rb,
lib/aws-sdk-core/pageable_response.rb,
lib/aws-sdk-core/partitions/region.rb,
lib/aws-sdk-core/rest/request/body.rb,
lib/aws-sdk-core/xml/error_handler.rb,
lib/aws-sdk-core/api/customizations.rb,
lib/aws-sdk-core/api/docs/crosslink.rb,
lib/aws-sdk-core/json/error_handler.rb,
lib/aws-sdk-core/partitions/service.rb,
lib/aws-sdk-core/plugins/s3_host_id.rb,
lib/aws-sdk-core/plugins/s3_sse_cpk.rb,
lib/aws-sdk-core/plugins/user_agent.rb,
lib/aws-sdk-core/rest/response/body.rb,
lib/aws-sdk-core/shared_credentials.rb,
lib/aws-sdk-core/stubbing/stub_data.rb,
lib/aws-sdk-core/stubbing/xml_error.rb,
lib/aws-sdk-core/credential_provider.rb,
lib/aws-sdk-core/log/param_formatter.rb,
lib/aws-sdk-core/query/param_builder.rb,
lib/aws-sdk-core/stubbing/empty_stub.rb,
lib/aws-sdk-core/partitions/partition.rb,
lib/aws-sdk-core/plugins/retry_errors.rb,
lib/aws-sdk-core/plugins/s3_dualstack.rb,
lib/aws-sdk-core/plugins/s3_redirects.rb,
lib/aws-sdk-core/rest/request/builder.rb,
lib/aws-sdk-core/rest/request/headers.rb,
lib/aws-sdk-core/rest/response/parser.rb,
lib/aws-sdk-core/cloudfront/url_signer.rb,
lib/aws-sdk-core/plugins/protocols/ec2.rb,
lib/aws-sdk-core/plugins/s3_accelerate.rb,
lib/aws-sdk-core/plugins/s3_bucket_dns.rb,
lib/aws-sdk-core/rest/request/endpoint.rb,
lib/aws-sdk-core/rest/response/headers.rb,
lib/aws-sdk-core/waiters/null_provider.rb,
lib/aws-sdk-core/xml/parser/engines/ox.rb,
lib/aws-sdk-core/plugins/request_signer.rb,
lib/aws-sdk-core/plugins/s3_control_dns.rb,
lib/aws-sdk-core/plugins/sqs_queue_urls.rb,
lib/aws-sdk-core/plugins/stub_responses.rb,
lib/aws-sdk-core/refreshing_credentials.rb,
lib/aws-sdk-core/s3/bucket_region_cache.rb,
lib/aws-sdk-core/stubbing/protocols/ec2.rb,
lib/aws-sdk-core/xml/parser/engines/oga.rb,
lib/aws-sdk-core/api/docs/shared_example.rb,
lib/aws-sdk-core/assume_role_credentials.rb,
lib/aws-sdk-core/plugins/param_converter.rb,
lib/aws-sdk-core/plugins/param_validator.rb,
lib/aws-sdk-core/plugins/protocols/query.rb,
lib/aws-sdk-core/plugins/response_paging.rb,
lib/aws-sdk-core/plugins/route_53_id_fix.rb,
lib/aws-sdk-core/query/ec2_param_builder.rb,
lib/aws-sdk-core/stubbing/protocols/json.rb,
lib/aws-sdk-core/stubbing/protocols/rest.rb,
lib/aws-sdk-core/api/docs/param_formatter.rb,
lib/aws-sdk-core/cloudfront/cookie_signer.rb,
lib/aws-sdk-core/dynamodb/attribute_value.rb,
lib/aws-sdk-core/plugins/endpoint_pattern.rb,
lib/aws-sdk-core/rds/auth_token_generator.rb,
lib/aws-sdk-core/stubbing/data_applicator.rb,
lib/aws-sdk-core/stubbing/protocols/query.rb,
lib/aws-sdk-core/xml/parser/engines/rexml.rb,
lib/aws-sdk-core/xml/parser/parsing_error.rb,
lib/aws-sdk-core/credential_provider_chain.rb,
lib/aws-sdk-core/partitions/partition_list.rb,
lib/aws-sdk-core/plugins/glacier_checksums.rb,
lib/aws-sdk-core/plugins/idempotency_token.rb,
lib/aws-sdk-core/plugins/regional_endpoint.rb,
lib/aws-sdk-core/plugins/s3_control_signer.rb,
lib/aws-sdk-core/plugins/s3_request_signer.rb,
lib/aws-sdk-core/plugins/swf_read_timeouts.rb,
lib/aws-sdk-core/rest/response/status_code.rb,
lib/aws-sdk-core/xml/parser/engines/libxml.rb,
lib/aws-sdk-core/plugins/api_gateway_header.rb,
lib/aws-sdk-core/plugins/csd_switch_to_post.rb,
lib/aws-sdk-core/plugins/endpoint_discovery.rb,
lib/aws-sdk-core/plugins/glacier_account_id.rb,
lib/aws-sdk-core/plugins/protocols/json_rpc.rb,
lib/aws-sdk-core/plugins/protocols/rest_xml.rb,
lib/aws-sdk-core/plugins/s3_http_200_errors.rb,
lib/aws-sdk-core/api/docs/docstring_provider.rb,
lib/aws-sdk-core/plugins/glacier_api_version.rb,
lib/aws-sdk-core/plugins/jsonvalue_converter.rb,
lib/aws-sdk-core/plugins/protocols/rest_json.rb,
lib/aws-sdk-core/plugins/s3_url_encoded_keys.rb,
lib/aws-sdk-core/stubbing/protocols/rest_xml.rb,
lib/aws-sdk-core/xml/parser/engines/nokogiri.rb,
lib/aws-sdk-core/instance_profile_credentials.rb,
lib/aws-sdk-core/plugins/global_configuration.rb,
lib/aws-sdk-core/plugins/s3_control_dualstack.rb,
lib/aws-sdk-core/stubbing/protocols/rest_json.rb,
lib/aws-sdk-core/api/docs/operation_documenter.rb,
lib/aws-sdk-core/plugins/ec2_region_validation.rb,
lib/aws-sdk-core/plugins/helpful_socket_errors.rb,
lib/aws-sdk-core/plugins/s3_expect_100_continue.rb,
lib/aws-sdk-core/plugins/s3_location_constraint.rb,
lib/aws-sdk-core/plugins/sts_regional_endpoints.rb,
lib/aws-sdk-core/api/docs/client_type_documenter.rb,
lib/aws-sdk-core/api/docs/request_syntax_example.rb,
lib/aws-sdk-core/plugins/csd_conditional_signing.rb,
lib/aws-sdk-core/plugins/rds_cross_region_copying.rb,
lib/aws-sdk-core/plugins/s3_iad_regional_endpoint.rb,
lib/aws-sdk-core/rest/request/querystring_builder.rb,
lib/aws-sdk-core/plugins/dynamodb_crc32_validation.rb,
lib/aws-sdk-core/plugins/dynamodb_extended_retries.rb,
lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb,
lib/aws-sdk-core/plugins/s3_get_bucket_location_fix.rb,
lib/aws-sdk-core/api/docs/response_structure_example.rb,
lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb,
lib/aws-sdk-core/plugins/s3_bucket_name_restrictions.rb,
lib/aws-sdk-core/plugins/machine_learning_predict_endpoint.rb

Defined Under Namespace

Modules: Api, Checksums, ClientStubs, ClientWaiters, CloudFront, CredentialProvider, Deprecations, DynamoDB, Errors, Json, Log, PageableResponse, Partitions, Plugins, Polly, Query, RDS, RefreshingCredentials, Rest, S3, Service, Signers, Stubbing, Waiters, Xml Classes: AssumeRoleCredentials, Client, CredentialProviderChain, Credentials, ECSCredentials, EagerLoader, EndpointCache, EndpointProvider, IniParser, InstanceProfileCredentials, Pager, ParamConverter, ParamValidator, SharedConfig, SharedCredentials, Structure, TreeHash, TypeBuilder

Constant Summary collapse

API_DIR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

File.join(File.dirname(File.dirname(__FILE__)), 'apis')
SERVICE_MODULE_NAMES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

services

%w(
  ACM
  ACMPCA
  APIGateway
  AccessAnalyzer
  AlexaForBusiness
  Amplify
  ApiGatewayManagementApi
  ApiGatewayV2
  AppConfig
  AppMesh
  AppStream
  AppSync
  ApplicationAutoScaling
  ApplicationDiscoveryService
  ApplicationInsights
  Athena
  AugmentedAIRuntime
  AutoScaling
  AutoScalingPlans
  Backup
  Batch
  Braket
  Budgets
  Chime
  Cloud9
  CloudDirectory
  CloudFormation
  CloudFront
  CloudHSM
  CloudHSMV2
  CloudSearch
  CloudSearchDomain
  CloudTrail
  CloudWatch
  CloudWatchEvents
  CloudWatchLogs
  CodeArtifact
  CodeBuild
  CodeCommit
  CodeDeploy
  CodeGuruProfiler
  CodeGuruReviewer
  CodePipeline
  CodeStar
  CodeStarNotifications
  CodeStarconnections
  CognitoIdentity
  CognitoIdentityProvider
  CognitoSync
  Comprehend
  ComprehendMedical
  ComputeOptimizer
  ConfigService
  Connect
  ConnectParticipant
  CostExplorer
  CostandUsageReportService
  DAX
  DLM
  DataExchange
  DataPipeline
  DataSync
  DatabaseMigrationService
  Detective
  DeviceFarm
  DirectConnect
  DirectoryService
  DocDB
  DynamoDB
  DynamoDBStreams
  EBS
  EC2
  EC2InstanceConnect
  ECR
  ECS
  EFS
  EKS
  EMR
  ElastiCache
  ElasticBeanstalk
  ElasticInference
  ElasticLoadBalancing
  ElasticLoadBalancingV2
  ElasticTranscoder
  ElasticsearchService
  EventBridge
  FMS
  FSx
  Firehose
  ForecastQueryService
  ForecastService
  FraudDetector
  GameLift
  Glacier
  GlobalAccelerator
  Glue
  Greengrass
  GroundStation
  GuardDuty
  Health
  Honeycode
  IAM
  IVS
  IdentityStore
  Imagebuilder
  ImportExport
  Inspector
  IoT
  IoT1ClickDevicesService
  IoT1ClickProjects
  IoTAnalytics
  IoTDataPlane
  IoTEvents
  IoTEventsData
  IoTJobsDataPlane
  IoTSecureTunneling
  IoTSiteWise
  IoTThingsGraph
  KMS
  Kafka
  Kendra
  Kinesis
  KinesisAnalytics
  KinesisAnalyticsV2
  KinesisVideo
  KinesisVideoArchivedMedia
  KinesisVideoMedia
  KinesisVideoSignalingChannels
  LakeFormation
  Lambda
  LambdaPreview
  Lex
  LexModelBuildingService
  LicenseManager
  Lightsail
  MQ
  MTurk
  MachineLearning
  Macie
  Macie2
  ManagedBlockchain
  MarketplaceCatalog
  MarketplaceCommerceAnalytics
  MarketplaceEntitlementService
  MarketplaceMetering
  MediaConnect
  MediaConvert
  MediaLive
  MediaPackage
  MediaPackageVod
  MediaStore
  MediaStoreData
  MediaTailor
  MigrationHub
  MigrationHubConfig
  Mobile
  Neptune
  NetworkManager
  OpsWorks
  OpsWorksCM
  Organizations
  Outposts
  PI
  Personalize
  PersonalizeEvents
  PersonalizeRuntime
  Pinpoint
  PinpointEmail
  PinpointSMSVoice
  Polly
  Pricing
  QLDB
  QLDBSession
  QuickSight
  RAM
  RDS
  RDSDataService
  Redshift
  Rekognition
  ResourceGroups
  ResourceGroupsTaggingAPI
  RoboMaker
  Route53
  Route53Domains
  Route53Resolver
  S3
  S3Control
  SES
  SESV2
  SMS
  SNS
  SQS
  SSM
  SSO
  SSOOIDC
  STS
  SWF
  SageMaker
  SageMakerRuntime
  SavingsPlans
  Schemas
  SecretsManager
  SecurityHub
  ServerlessApplicationRepository
  ServiceCatalog
  ServiceDiscovery
  ServiceQuotas
  Shield
  Signer
  SimpleDB
  Snowball
  States
  StorageGateway
  Support
  Synthetics
  Textract
  TranscribeService
  Transfer
  Translate
  WAF
  WAFRegional
  WAFV2
  WorkDocs
  WorkLink
  WorkMail
  WorkMailMessageFlow
  WorkSpaces
  XRay
)
VERSION =
'2.11.570'
EmptyStructure =
Class.new(Structure.new('AwsEmptyStructure'))

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configHash

Returns a hash of default configuration options shared by all constructed clients.

Returns:

  • (Hash)

    Returns a hash of default configuration options shared by all constructed clients.



464
465
466
# File 'lib/aws-sdk-core.rb', line 464

def config
  @config
end

Class Method Details

.add_service(svc_name, options = {}) ⇒ Module<Service>

Registers a new service.

Aws.add_service('SvcName',
  api: '/path/to/svc.api.json',
  paginators: '/path/to/svc.paginators.json',
  waiters: '/path/to/svc.waiters.json',
  resources: '/path/to/svc.resources.json')

Aws::SvcName::Client.new
#=> #<Aws::SvcName::Client>

Parameters:

  • svc_name (String)

    The name of the service. This will also be the namespace under Aws. This must be a valid constant name.

  • options[String,Pathname,Hash,Seahorse::Model::Api,nil] (Hash)

    a customizable set of options

  • options[String,Pathname,Hash,nil] (Hash)

    a customizable set of options

  • options[String,Pathname,Hash,Waiters::Provider,nil] (Hash)

    a customizable set of options

  • options[String,Pathname,Hash,Resources::Definition,nil] (Hash)

    a customizable set of options

Returns:

  • (Module<Service>)

    Returns the new service module.



634
635
636
637
638
639
640
641
642
# File 'lib/aws-sdk-core.rb', line 634

def add_service(svc_name, options = {})
  svc_module = Module.new { extend Service }
  const_set(svc_name, svc_module)
  @services[svc_name] = [svc_module, options]
  @service_added_callbacks.each do |callback|
    callback.call(svc_name.to_s, *@services[svc_name])
  end
  svc_module
end

.eager_autoload!(options = {}) ⇒ void

This method returns an undefined value.

Loads modules that are normally loaded with Ruby’s ‘autoload`. This can avoid thread-safety issues that some Ruby versions have with `autoload`.

# loads ALL services
Aws.eager_autoload!

Loading all services can be slow. You can specify what services you want to load with the ‘:services` option. All services not named will continue to autoload as normal.

Aws.eager_autoload!(services: %w(S3 EC2))


581
582
583
584
585
586
587
588
589
# File 'lib/aws-sdk-core.rb', line 581

def eager_autoload!(options = {})
  eager_loader = EagerLoader.new
  eager_loader.load(JMESPath)
  eager_loader.load(Seahorse)
  sub_modules(options).each do |module_or_class|
    eager_loader.load(module_or_class)
  end
  eager_loader
end

.empty_connection_pools!nil

Close any long-lived connections maintained by the SDK’s internal connection pool.

Applications that rely heavily on the ‘fork()` system call on POSIX systems should call this method in the child process directly after fork to ensure there are no race conditions between the parent process and its children for the pooled TCP connections.

Child processes that make multi-threaded calls to the SDK should block on this call before beginning work.

Returns:

  • (nil)


561
562
563
564
565
# File 'lib/aws-sdk-core.rb', line 561

def empty_connection_pools!
  Seahorse::Client::NetHttp::ConnectionPool.pools.each do |pool|
    pool.empty!
  end
end

.partition(partition_name) ⇒ Partitions::Partition

Return the partition with the given name. A partition describes the services and regions available in that partition.

aws = Aws.partition('aws')

puts "Regions available in the aws partition:\n"
aws.regions.each do |region|
  puts region.name
end

puts "Services available in the aws partition:\n"
aws.services.each do |services|
  puts services.name
end

See Partitions for more information and examples.

Parameters:

  • partition_name (String)

    The name of the partition to return. Valid names include “aws”, “aws-cn”, and “aws-us-gov”.

Returns:

Raises:

  • (ArgumentError)

    Raises an ‘ArgumentError` if a partition is not found with the given name. The error message contains a list of valid partition names.



500
501
502
# File 'lib/aws-sdk-core.rb', line 500

def partition(partition_name)
  Partitions.default_list.partition(partition_name)
end

.partitionsArray<Partitions::Partition>

Return an array of partitions. A partition describes the services and regions available in that partition.

Aws.partitions.each do |partition|

  puts "Regions available in #{partition.name}:\n"
  partition.regions.each do |region|
    puts region.name
  end

  puts "Services available in #{partition.name}:\n"
  partition.services.each do |service|
    puts service.name
  end
end

See Partitions for more information and examples.

Returns:



524
525
526
# File 'lib/aws-sdk-core.rb', line 524

def partitions
  Partitions.default_list.partitions
end

.service_added(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields to the given block for each service that has already been defined via add_service. Also yields to the given block for each new service added after the callback is registered.



608
609
610
611
612
613
614
# File 'lib/aws-sdk-core.rb', line 608

def service_added(&block)
  callback = block if block_given?
  @services.each do |svc_name, (svc_module, options)|
    yield(svc_name, svc_module, options)
  end
  @service_added_callbacks << callback
end

.shared_configObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



457
458
459
460
# File 'lib/aws-sdk-core.rb', line 457

def shared_config
  enabled = ENV["AWS_SDK_CONFIG_OPT_OUT"] ? false : true
  @shared_config ||= SharedConfig.new(config_enabled: enabled)
end

.sub_modules(options = {}) ⇒ Object



591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/aws-sdk-core.rb', line 591

def sub_modules(options = {})
  constants = Aws.constants.map(&:to_s)
  if options[:services]
    constants -= SERVICE_MODULE_NAMES
    constants += options[:services] || SERVICE_MODULE_NAMES
  end
  constants.inject([]) do |modules, const_name|
    constant = Aws.const_get(const_name)
    modules << constant if Module === constant
    modules
  end
end

.use_bundled_cert!String

The SDK ships with a ca certificate bundle to use when verifying SSL peer certificates. By default, this cert bundle is NOT used. The SDK will rely on the default cert available to OpenSSL. This ensures the cert provided by your OS is used.

For cases where the default cert is unavailable, e.g. Windows, you can call this method.

Aws.use_bundled_cert!

Returns:

  • (String)

    Returns the path to the bundled cert.



539
540
541
542
543
544
545
546
547
# File 'lib/aws-sdk-core.rb', line 539

def use_bundled_cert!
  config.delete(:ssl_ca_directory)
  config.delete(:ssl_ca_store)
  config[:ssl_ca_bundle] = File.expand_path(File.join(
    File.dirname(__FILE__),
    '..',
    'ca-bundle.crt'
  ))
end