4

I am running into an error attempting to authenticate and create a new Route53 Record Set using the Amazon's PHP SDK and changeresourceRecordSets. Here's what I have attempted so far:

  1. Installed the AWS SDK for Laravel
  2. Used Amazon's IAM to create a new user and group and applied the FullAdministrator policy to the group.
  3. Stored the new user credentials and other AWS variables in my .env file like so:

Code below:

AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=XXYYZZ
AWS_SECRET_ACCESS_KEY=112233
AWS_ZONE_ID=UHUHUHUH
  1. Confirmed that my Laravel environment is configured correctly and my controller works by testing the following:

Code below:

$s3 = AWS::createClient('s3');
$s3->putObject(array(
  'Bucket'     => 'mydomain.com',
  'Key'        => 'new.pdf',
  'SourceFile' => storage_path('app/old.pdf'),
));
  1. Once I confirmed that my credentials worked against S3, I closely followed this SO answer and code to create a new Route53 client and create a new Record Set in my Route53 Hosted Zone. Here's my slightly modified code:

Code below:

$client = AWS::createClient('Route53');
//dd($client);  $client object returned, this works

$result = $client->changeResourceRecordSets(array(
    'HostedZoneId' => env('AWS_ZONE_ID'),
    'ChangeBatch' => array(
        'Comment' => 'just testing',
        'Changes' => array(
            array(
                'Action' => 'CREATE',
                'ResourceRecordSet' => array(
                    'Name' => 'test.mydomain.com.',
                    'Type' => 'A',
                    'TTL' => 600,
                    'ResourceRecords' => array(
                        array(
                            'Value' => '52.52.52.52',//my AWS IP address
                        ),
                    ),
                ),
            ),
        ),
    ),
));
  1. The resulting error is as follows:

Client error: POST https://route53.amazonaws.com/2013-04-01/hostedzone/MYZONE/rrset/ resulted in a 403 Forbidden response: Sender

And more from the error...

SignatureDoesNotMatch (client): Signature expired: 20160225T215502Z is now earlier than 20160225T220842Z (20160225T221342Z - 5 min.)

Any suggestions are appreciated.

Community
  • 1
  • 1
Gunnar
  • 661
  • 1
  • 11
  • 29
  • The error indicates that your system clock is out of sync. Does the error still occur if you run an NTP update? – giaour Feb 25 '16 at 23:21

1 Answers1

0

I should have added that I'm running in a homestead/virtualbox environment and the real problem was that my date service on my VM was woefully off.

Simply running sudo ntpdate -s time.nist.gov fixed the problem.

Gunnar
  • 661
  • 1
  • 11
  • 29