Route53 client
This page contains examples with the Route53 client. See the client introduction for a more detailed description how to use a client. You may also want to consider the authentication documentation to understand the many ways you can authenticate with AWS.
The Route53 package could be installed with Composer.
composer require async-aws/route53
A new client object may be instantiated by:
use AsyncAws\Route53\Route53Client;
$route53 = new Route53Client();
The authentication parameters is read from the environment by default. You can also specify a AWS access id and secret:
use AsyncAws\Route53\Route53Client;
$route53 = new Route53Client([
'accessKeyId' => 'my_access_key',
'accessKeySecret' => 'my_access_secret',
'region' => 'eu-central-1',
]);
For all available options, see the configuration reference.
Usage¶
List hosted zones¶
use AsyncAws\Route53\Route53Client;
$route53 = new Route53Client();
foreach ($route53->listHostedZones() as $zone) {
echo $zone->getName();
}
Create hosted zone¶
use AsyncAws\Route53\Input\CreateHostedZoneRequest;
use AsyncAws\Route53\ValueObject\HostedZoneConfig;
use AsyncAws\Route53\Route53Client;
$route53 = new Route53Client();
$route53->createHostedZone(
new CreateHostedZoneRequest([
'CallerReference' => 'uniqueId',
'Name' => 'example.com',
'HostedZoneConfig' => new HostedZoneConfig([
'Comment' => 'foo',
]),
])
);
The source code to this page is found on GitHub.