docs.aws.amazon.com Open in urlscan Pro
18.66.147.76  Public Scan

URL: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html
Submission: On July 28 via api from BE — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

SELECT YOUR COOKIE PREFERENCES

We use essential cookies and similar tools that are necessary to provide our
site and services. We use performance cookies to collect anonymous statistics so
we can understand how customers use our site and make improvements. Essential
cookies cannot be deactivated, but you can click “Customize cookies” to decline
performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide
useful site features, remember your preferences, and display relevant content,
including relevant advertising. To continue without accepting these cookies,
click “Continue without accepting.” To make more detailed choices or learn more,
click “Customize cookies.”

Accept all cookiesContinue without acceptingCustomize cookies


CUSTOMIZE COOKIE PREFERENCES

We use cookies and similar tools (collectively, "cookies") for the following
purposes.


ESSENTIAL

Essential cookies are necessary to provide our site and services and cannot be
deactivated. They are usually set in response to your actions on the site, such
as setting your privacy preferences, signing in, or filling in forms.




PERFORMANCE

Performance cookies provide anonymous statistics about how customers navigate
our site so we can improve site experience and performance. Approved third
parties may perform analytics on our behalf, but they cannot use the data for
their own purposes.

Allow performance category
Allowed


FUNCTIONAL

Functional cookies help us provide useful site features, remember your
preferences, and display relevant content. Approved third parties may set these
cookies to provide certain site features. If you do not allow these cookies,
then some or all of these services may not function properly.

Allow functional category
Allowed


ADVERTISING

Advertising cookies may be set through our site by us or our advertising
partners and help us deliver relevant marketing content. If you do not allow
these cookies, you will experience less relevant advertising.

Allow advertising category
Allowed

Blocking some types of cookies may impact your experience of our sites. You may
review and change your choices at any time by clicking Cookie preferences in the
footer of this site. We and selected third-parties use cookies or similar
technologies as specified in the AWS Cookie Notice.

CancelSave preferences




UNABLE TO SAVE COOKIE PREFERENCES

We will only store essential cookies at this time, because we were unable to
save your cookie preferences.

If you want to change your cookie preferences, try again later using the link in
the AWS console footer, or contact support if the problem persists.

Dismiss


Contact Us
English


Create an AWS Account
 1. AWS
 2. ...
    
    
 3. Documentation
 4. Amazon EC2
 5. User Guide for Linux Instances

Feedback
Preferences


AMAZON ELASTIC COMPUTE CLOUD


USER GUIDE FOR LINUX INSTANCES

 * What is Amazon EC2?
 * Set up
 * Get started tutorial
 * Best practices
 * Working with AWS SDKs
 * Tutorials
    * Install LAMP
       * Amazon Linux 2023
       * Amazon Linux 2
       * Amazon Linux
   
    * Configure SSL/TLS
       * Amazon Linux 2023
       * Amazon Linux 2
       * Amazon Linux
   
    * Host a WordPress blog
       * Amazon Linux 2023
       * Amazon Linux 2
   
    * Increase size of Amazon EBS volume
       * Step 1: Launch an instance with added volume
       * Step 2: Make the data volume available for use
       * Step 3: Increase the size of the data volume
       * Step 4: Extend the file system
       * Step 5: Clean up

 * Amazon Machine Images
    * AMI types
    * Virtualization types
    * Boot modes
       * Launch an instance
       * AMI boot mode parameter
       * Instance type boot mode
       * Instance boot mode
       * Operating system boot mode
       * Set AMI boot mode
       * UEFI variables
       * UEFI Secure Boot
          * How UEFI Secure Boot works
          * Launch an instance with UEFI Secure Boot support
          * Verify whether an instance is enabled for UEFI Secure Boot
          * Create a Linux AMI to support UEFI Secure Boot
             * Create three key pairs
             * Option A: Add keys to the variable store from within the instance
             * Option B: Create a binary blob containing a pre-filled variable
               store
         
          * How the AWS binary blob is created
   
    * Find a Linux AMI
    * Shared AMIs
       * Find shared AMIs
       * Make an AMI public
       * Share an AMI with organizations or OUs
       * Share an AMI with specific AWS accounts
       * Cancel having an AMI shared with your account
       * Use bookmarks
       * Guidelines for shared Linux AMIs
   
    * Paid AMIs
    * AMI lifecycle
       * Create an AMI
          * Create an Amazon EBS-backed Linux AMI
          * Create an instance store-backed Linux AMI
             * Set up the AMI tools
             * Create an AMI from an instance store-backed instance
             * Convert to an Amazon EBS-Backed AMI
             * AMI tools reference
      
       * Modify an AMI
       * Copy an AMI
       * Store and restore an AMI
       * Deprecate an AMI
       * Deregister your AMI
       * Recover AMIs from the Recycle Bin
       * Automate the EBS-backed AMI lifecycle
   
    * Use encryption with EBS-backed AMIs
    * Monitor AMI events
    * Understand AMI billing
       * AMI billing fields
       * Find AMI billing information
       * Verify AMI charges on your bill
   
    * Amazon Linux
       * Run Amazon Linux 2 on premises
       * Kernel Live Patching
   
    * User provided kernels
    * Configure the MATE desktop connection
    * AMI quotas

 * Instances
    * Instances and AMIs
    * Instance types
       * General purpose
          * Burstable performance instances
             * Key concepts
             * Unlimited mode
                * Concepts
                * Examples
            
             * Standard mode
                * Concepts
                * Examples
            
             * Work with burstable performance instances
             * Monitor your CPU credits
      
       * Compute optimized
       * Memory optimized
       * Storage optimized
       * Accelerated computing
          * Install NVIDIA drivers
          * Install AMD drivers
          * Dual 4k on G4ad
          * Activate NVIDIA GRID Virtual Applications
          * Optimize GPU settings
      
       * Find an instance type
       * Get recommendations
       * Change the instance type
          * Compatibility
          * Troubleshoot
          * Instance store-backed instances
   
    * Mac instances
    * Instance purchasing options
       * On-Demand Instances
       * Reserved Instances
          * Regional and zonal Reserved Instances (scope)
          * Types of Reserved Instances (offering classes)
          * How Reserved Instances are applied
          * Use your Reserved Instances
          * How you are billed
          * Buy Reserved Instances
          * Sell in the Reserved Instance Marketplace
          * Modify Reserved Instances
          * Exchange Convertible Reserved Instances
          * Reserved Instance quotas
      
       * Spot Instances
          * Best practices
          * How Spot Instances work
          * Spot Instance pricing history
          * Savings
          * Work with Spot Instances
             * Example launch specifications
         
          * Spot request status
          * Rebalance recommendations
          * Spot Instance interruptions
             * Reasons for interruption
             * Interruption behavior
             * Stop
             * Hibernate
             * Terminate
             * Prepare for interruptions
             * Initiate a Spot Instance interruption
             * Spot Instance interruption notices
             * Find interrupted Spot Instances
             * Determine whether Amazon EC2 terminated a Spot Instance
             * Billing
         
          * Spot placement score
          * Spot Instance data feed
          * Spot Instance quotas
          * Burstable performance instances
      
       * Dedicated Hosts
          * Work with Dedicated Hosts
          * Work with shared Dedicated Hosts
          * Dedicated Hosts on AWS Outposts
          * Host recovery
          * Host maintenance
          * Track configuration changes
      
       * Dedicated Instances
          * Work with Dedicated Instances
      
       * On-Demand Capacity Reservations
          * Capacity Reservation pricing and billing
          * Work with Capacity Reservations
          * Work with Capacity Reservation groups
          * Capacity Reservations in cluster placement groups
          * Capacity Reservations in Local Zones
          * Capacity Reservations in Wavelength Zones
          * Capacity Reservations on AWS Outposts
          * Work with shared Capacity Reservations
          * Capacity Reservation Fleets
             * Capacity Reservation Fleet concepts
             * Work with Capacity Reservation Fleets
             * Example configurations
             * Using service-linked roles
         
          * Monitoring Capacity Reservations
             * CloudWatch metrics
             * EventBridge events
             * Utilization notifications
   
    * Instance lifecycle
       * Launch
          * Launch using the launch instance wizard
             * Old launch instance wizard
         
          * Launch using a launch template
             * Restrictions
             * Control launching instances
             * Create
             * Modify (manage versions)
             * Delete
             * Launch instances
         
          * Launch an instance from an existing instance
          * Use an AWS Marketplace instance
      
       * Stop and start
       * Hibernate
          * Overview
          * Prerequisites
          * Limitations
          * Configure an AMI to support hibernation
          * Enable hibernation for an instance
          * Disable KASLR on an instance (Ubuntu only)
          * Hibernate an instance
          * Start a hibernated instance
          * Troubleshoot
      
       * Reboot
       * Retire
       * Terminate
       * Recover
   
    * Connect
       * Connect to your instance
          * Set up to connect
          * Connect using SSH
          * Connect using EC2 Instance Connect
             * Prerequisites
             * Permissions
             * Install EC2 Instance Connect
             * Connect using EC2 Instance Connect
             * Uninstall EC2 Instance Connect
         
          * Connect from Windows using OpenSSH (Recommended)
          * Connect from Windows using PuTTY
          * Connect from Windows using WSL
          * Connect using Session Manager
          * Connect using CloudShell
      
       * Connect to instances without requiring a public IPv4 address
          * Permissions
          * Security groups
          * Create an EC2 Instance Connect Endpoint
          * Connect to an instance
          * Log connections
          * Remove EC2 Instance Connect Endpoint
          * Service-linked role
          * Quotas
      
       * Connect your instance to a resource
          * Tutorial: Connect an EC2 instance to an RDS database
             * Option 1: Automatically connect – EC2 console
                * Task 1: Create an RDS database – optional
                * Task 2: Launch an EC2 instance – optional
                * Task 3: Automatically connect your EC2 instance to your RDS
                  database
                * Task 4: Verify the connection configuration
            
             * Option 2: Automatically connect – RDS console
                * Task 1: Launch an EC2 instance – optional
                * Task 2: Create an RDS database and automatically connect it to
                  your EC2 instance
                * Task 3: Verify the connection configuration
            
             * Option 3: Manually connect (create security groups)
                * Task 1: Launch an EC2 instance – optional
                * Task 2: Create an RDS database – optional
                * Task 3: Manually connect your EC2 instance to your RDS
                  database
            
             * Clean up
   
    * Configure instances
       * Manage software
          * Update software
          * Add repositories
          * Find and install software packages
          * Prepare to compile software
      
       * Manage users
       * Processor state control
       * I/O scheduler
       * Set the time
       * Optimize CPU options
          * Rules for specifying CPU options
          * CPU cores and threads per CPU core per instance type
          * Specify CPU options for your instance
          * View the CPU options for your instance
      
       * CPU features
          * AMD SEV-SNP
             * Requirements
             * Considerations
             * Concepts and terminology
             * Working with AMD SEV-SNP
             * Attestation with AMD SEV-SNP
      
       * Change the hostname
       * Set up dynamic DNS
       * Run commands at launch
       * Instance metadata and user data
          * Use IMDSv2
             * How IMDSv2 works
             * Transition to using IMDSv2
             * Supported SDKs
         
          * Configure the instance metadata options
             * For new instances
             * For existing instances
         
          * Retrieve instance metadata
          * Work with instance user data
          * Retrieve dynamic data
          * Instance metadata categories
          * Example: AMI launch index value
          * Instance identity documents
             * Verify using the PKCS7 signature
             * Verify using the base64-encoded signature
             * Verify using the RSA-2048 signature
         
          * Instance identity roles
   
    * Amazon EI
    * Identify instances

 * Fleets
    * EC2 Fleet
       * EC2 Fleet request types
          * EC2 Fleet 'instant' type
      
       * EC2 Fleet configuration strategies
          * Plan an EC2 Fleet
          * Allocation strategies for Spot Instances
          * Attribute-based instance type selection
          * On-Demand backup
          * Capacity Rebalancing
          * Maximum price overrides
          * Control spending
          * Instance weighting
      
       * Work with EC2 Fleets
   
    * Spot Fleet
       * Spot Fleet request types
       * Spot Fleet configuration strategies
          * Plan a Spot Fleet request
          * Allocation strategies for Spot Instances
          * Attribute-based instance type selection
          * On-Demand in Spot Fleet
          * Capacity Rebalancing
          * Spot price overrides
          * Control spending
          * Instance weighting
      
       * Work with Spot Fleets
       * CloudWatch metrics for Spot Fleet
       * Automatic scaling for Spot Fleet
          * Target tracking scaling policies
          * Step scaling policies
          * Scheduled scaling
   
    * Monitor fleet events
       * EC2 Fleet event types
       * Spot Fleet event types
       * Create EventBridge rules
          * For EC2 Fleet events
          * For Spot Fleet events
   
    * Tutorials
       * Tutorial: Use EC2 Fleet with instance weighting
       * Tutorial: Use EC2 Fleet with On-Demand as the primary capacity
       * Tutorial: Launch On-Demand Instances using targeted Capacity
         Reservations
       * Tutorial: Use Spot Fleet with instance weighting
   
    * Example configurations
       * EC2 Fleet example configurations
       * Spot Fleet example configurations
   
    * Fleet quotas

 * Monitor
    * Automated and manual monitoring
    * Best practices for monitoring
    * Monitor the status of your instances
       * Instance status checks
       * State change events
       * Scheduled events
          * Define event windows for scheduled events
   
    * Monitor your instances using CloudWatch
       * Enable detailed monitoring
       * List available metrics
       * Get statistics for metrics
          * Get statistics for a specific instance
          * Aggregate statistics across instances
          * Aggregate statistics by Auto Scaling group
          * Aggregate statistics by AMI
      
       * Graph metrics
       * Create an alarm
       * Create alarms that stop, terminate, reboot, or recover an instance
   
    * Automate using EventBridge
    * Monitor memory and disk metrics
       * Deprecated: Collect metrics using the CloudWatch monitoring scripts
   
    * Log API calls with AWS CloudTrail

 * Networking
    * Regions and Zones
    * Instance IP addressing
       * Multiple IP addresses
   
    * Instance hostname types
    * Bring your own IP addresses
    * Elastic IP addresses
    * Network interfaces
       * Best practices for configuring network interfaces
       * Scenarios for network interfaces
       * Requester-managed network interfaces
       * Assign prefixes
          * Work with prefixes
   
    * Network bandwidth
    * Enhanced networking
       * Elastic Network Adapter (ENA)
       * ENA Express
       * Intel 82599 VF
       * Operating system optimizations
       * Network performance metrics
       * Troubleshoot ENA
       * Improve network latency on Linux instances
   
    * Elastic Fabric Adapter
       * Get started with EFA and MPI
       * Get started with EFA and NCCL
          * Use a base AMI
          * Use an AWS Deep Learning AMI
      
       * Work with EFA
       * Monitor an EFA
       * Verify the EFA installer using a checksum
   
    * Placement groups
       * Share a placement group
       * Placement groups on AWS Outposts
   
    * Network MTU
    * Virtual private clouds
    * EC2-Classic
       * ClassicLink
       * Migrate from EC2-Classic to a VPC

 * Code examples
    * Actions
       * Add tags to resources
       * Allocate an Elastic IP address
       * Associate an Elastic IP address with an instance
       * Create a security group
       * Create a security key pair
       * Create and run an instance
       * Delete a security group
       * Delete a security key pair
       * Delete a snapshot
       * Describe Availability Zones
       * Describe Regions
       * Describe instance status
       * Describe instances
       * Describe snapshots
       * Disable detailed monitoring
       * Disassociate an Elastic IP address from an instance
       * Enable monitoring
       * Get data about Amazon Machine Images
       * Get data about a security group
       * Get data about instance types
       * Get details about Elastic IP addresses
       * List security key pairs
       * Reboot an instance
       * Release an Elastic IP address
       * Set inbound rules for a security group
       * Start an instance
       * Stop an instance
       * Terminate an instance
   
    * Scenarios
       * Get started with instances

 * Security
    * Infrastructure security
    * Resilience
    * Data protection
    * Identity and access management
       * IAM policies
          * Policy structure
          * Tag resources during creation
          * Control access to EC2 resources using resource tags
          * Example policies for CLI or SDK
          * Example policies for the console
      
       * AWS managed policies
       * IAM roles
       * Network access
   
    * Key pairs
       * Create key pairs
       * Tag a public key
       * Describe public keys
       * Delete a public key
       * Add or remove a public key on your instance
       * Verify the fingerprint
   
    * Security groups
       * Security group rules
       * Connection tracking
       * Default and custom security groups
       * Work with security groups
       * Security group rules for different use cases
   
    * AWS PrivateLink
    * Update management
    * Compliance validation
    * NitroTPM
       * Considerations
       * Prerequisites
       * Create a Linux AMI for NitroTPM support
       * Verify whether an AMI is enabled for NitroTPM
       * Enable or stop using NitroTPM on an instance

 * Storage
    * Amazon EBS
       * EBS volumes
          * EBS volume types
             * General Purpose SSD volumes
             * Provisioned IOPS SSD volumes
             * Throughput Optimized HDD and Cold HDD volumes
         
          * Size and configuration constraints
          * Create a volume
          * Attach a volume to an instance
          * Attach a volume to multiple instances
          * Make a volume available for use
          * View volume details
          * Replace a volume
          * Replace a root volume
          * Monitor the status of your volumes
          * Detach a volume from an instance
          * Delete a volume
          * Fault testing
      
       * EBS snapshots
          * Create snapshots
          * Delete a snapshot
          * Copy a snapshot
          * Archive snapshots
             * Guidelines and best practices for archiving snapshots
             * Required IAM permissions
             * Work with snapshot archiving
             * Monitor snapshot archiving
         
          * View snapshot information
          * Share a snapshot
          * Recover snapshots from the Recycle Bin
          * Local snapshots on Outposts
          * Amazon EBS direct APIs
             * IAM permissions for EBS direct APIs
             * Use EBS direct APIs
                * Read snapshots
                * Write snapshots
                * Use encryption
                * Use Signature Version 4 signing
                * Use checksums
                * Idempotency for StartSnapshot API
                * Error retries
                * Optimize performance
                * EBS direct APIs service endpoints
            
             * Interface VPC endpoints
             * Log API calls with AWS CloudTrail
             * Frequently asked questions
         
          * Automate the snapshot lifecycle
      
       * Amazon Data Lifecycle Manager
          * Automate snapshot lifecycles
          * Automate AMI lifecycles
          * Automate cross-account snapshot copies
          * View, modify, and delete lifecycle policies
          * AWS Identity and Access Management
             * AWS managed policies
             * IAM service roles
             * Permissions for users
             * Permissions for encryption
         
          * Monitor the lifecycle of snapshots and AMIs
             * Monitor your policies using CloudWatch Events
             * Monitor your policies using Amazon CloudWatch
      
       * EBS data services
          * Elastic volumes
             * Requirements
             * Request volume modifications
             * Monitor modifications
             * Extend a file system
         
          * EBS encryption
          * Fast snapshot restore
      
       * EBS volumes and NVMe
       * EBS optimization
       * EBS performance
          * I/O characteristics and monitoring
          * Initialize volumes
          * RAID configuration
          * Benchmark EBS volumes
      
       * EBS CloudWatch metrics
       * EBS EventBridge events
       * EBS quotas
   
    * Instance store
       * Instance store volumes
       * Add instance store volumes
       * SSD instance store volumes
       * Instance store swap volumes
       * Optimize disk performance
   
    * File storage
       * Amazon S3
       * Amazon EFS
       * Amazon FSx
   
    * Instance volume limits
    * Root device volume
    * Device names
    * Block device mappings
    * Torn write prevention

 * Resources and tags
    * Recycle Bin
       * Considerations
       * Required IAM permissions
          * Condition keys for Recycle Bin
      
       * Work with retention rules
       * Work with resources in the Recycle Bin
       * Monitor Recycle Bin
          * Monitor using EventBridge
          * Monitor using CloudTrail
   
    * Resource locations
    * Resource IDs
    * List and filter your resources
    * Tag your resources
    * Service quotas
    * Usage reports

 * Troubleshoot
    * Troubleshoot launch issues
    * Connect to your instance
    * Stop your instance
    * Terminate your instance
    * Failed status checks
    * Troubleshoot an unreachable instance
    * Boot from the wrong volume
    * EC2Rescue for Linux
       * Install EC2Rescue for Linux
       * (Optional) Verify the signature of EC2Rescue for Linux
       * Work with EC2Rescue for Linux
       * Develop EC2Rescue modules
   
    * EC2 Serial Console
       * Prerequisites
       * Configure access to the EC2 Serial Console
       * Connect to the EC2 Serial Console
       * Terminate an EC2 Serial Console session
       * Troubleshoot your instance using the EC2 Serial Console
          * Troubleshoot your Linux instance using GRUB
          * Troubleshoot your Linux instance using SysRq
   
    * Send a diagnostic interrupt

 * Related information
 * Document history

Set the time for your Linux instance - Amazon Elastic Compute Cloud
AWSDocumentationAmazon EC2User Guide for Linux Instances
Configure the time for clients with Amazon Time Sync Public NTP Configure the
time for EC2 instances with IPv4 addressesConfigure the time for EC2 instances
with IPv6 addressesChange the time zone on Amazon LinuxCompare timestamps


SET THE TIME FOR YOUR LINUX INSTANCE

PDFRSS

A consistent and accurate time reference is crucial for many server tasks and
processes. Most system logs include a time stamp that you can use to determine
when problems occurred and in what order the events took place. If you use the
AWS CLI or an AWS SDK to make requests from your instance, these tools sign
requests on your behalf. If your instance's date and time are not set correctly,
the date in the signature might not match the date of the request, and AWS
rejects the request.

Amazon provides the Amazon Time Sync Service, which is accessible from all EC2
instances, and is also used by other AWS services. This service uses a fleet of
satellite-connected and atomic reference clocks in each AWS Region to deliver
accurate current time readings of the Coordinated Universal Time (UTC) global
standard through Network Time Protocol (NTP). The Amazon Time Sync Service
automatically smooths any leap seconds that are added to UTC.

The Amazon Time Sync Service is available through NTP at the 169.254.169.123
IPv4 address or the fd00:ec2::123 IPv6 address. The IPv6 address is only
accessible on Instances built on the Nitro System. Your instance does not
require access to the internet, and you do not have to configure your security
group rules or your network ACL rules to allow access. The latest versions of
Amazon Linux 2 and Amazon Linux AMIs synchronize with the Amazon Time Sync
Service by default.

For a backup to the Amazon Time Sync link-local service, and to connect
resources outside of Amazon EC2 to the Amazon Time Sync Service, you can use the
Amazon Time Sync Public NTP pool located at time.aws.com. Amazon Time Sync
Public NTP, like the Amazon Time Sync service, automatically smooths any leap
seconds that are added to UTC. The Amazon Time Sync Service Public NTP is
supported globally by our fleet of satellite-connected and atomic reference
clocks in each AWS Region.

Use the following procedures to configure the Amazon Time Sync Service on your
instance using the chrony client. Alternatively, you can use external NTP
sources. For more information about NTP and public time sources, see
http://www.ntp.org/. An instance needs access to the internet for the external
NTP time sources to work.

For Windows instances, see Set the time for a Windows instance.

TOPICS

 * Configure the time for clients with Amazon Time Sync Public NTP
 * Configure the time for EC2 instances with IPv4 addresses
 * Configure the time for EC2 instances with IPv6 addresses
 * Change the time zone on Amazon Linux
 * Compare timestamps


CONFIGURE THE TIME FOR CLIENTS WITH AMAZON TIME SYNC PUBLIC NTP

You can configure your client machine to use Amazon Time Sync.

TO CONFIGURE AMAZON TIME SYNC PUBLIC NTP FOR APPLE MACOS

 1. On your client machine, open System Preferences.

 2. Choose Date & Time, and then choose the Date & Time tab.

 3. To make changes, choose the lock icon, and enter your password when
    prompted.

 4. For Set date and time automatically, enter time.aws.com.

TO CONFIGURE AMAZON TIME SYNC PUBLIC NTP FOR LINUX (CHRONY OR NTPD)

 1. Edit /etc/chrony/chrony.conf (if you use chrony) or /etc/ntp.conf (if you
    use ntpd) using your favorite text editor as follows:
    
    1. To prevent your instance from trying to mix smeared and non-smeared
       servers, remove or comment out lines starting with server.
       
       IMPORTANT
       
       To ensure your instance stays connected to the local Amazon Time Sync
       service, do not edit the following line.
       
       server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4
    
    2. Add the following line.
       
       pool time.aws.com iburst

 2. Choose NAME.

 3. Restart the daemon using the following command.
    
     * chrony
       
       sudo service chrony force-reload
    
     * ntpd
       
       sudo service ntp reload

 4. Edit the systemd/timesyncd file using your favorite text editor and set the
    content of the [Time] block to the following. By configuring the Amazon Time
    Sync Service Public NTP as the fallback server, it will be selected as the
    only NTP server. This prevents inadvertently moving between smeared and
    unsmeared time servers.
    
    [Time] NTP=FallbackNTP=time.aws.com 

 5. Restart systemd-timesyncd using the following command as a user with
    appropriate permissions.
    
    systemctl restart systemd-timesyncd.service

 6. Verify that your system is using the Amazon Time Sync Public NTP pool using
    the following command.
    
    timedatectl show-timesync | grep ServerName
    
    If successfully configured, the output will show the following:
    
    ServerName=time.aws.com


CONFIGURE THE TIME FOR EC2 INSTANCES WITH IPV4 ADDRESSES

This section describes how to set the time for EC2 instances with IPv4 addresses
depending on the type of Linux distribution.

TOPICS

 * Configure the Amazon Time Sync Service on Amazon Linux AMI
 * Configure the Amazon Time Sync Service on Ubuntu
 * Configure the Amazon Time Sync Service on SUSE Linux


CONFIGURE THE AMAZON TIME SYNC SERVICE ON AMAZON LINUX AMI

NOTE

On Amazon Linux 2, chrony is already installed and configured to use the Amazon
Time Sync Service IP address.

With the Amazon Linux AMI, you must edit the chrony configuration file to add a
server entry for the Amazon Time Sync Service.

TO CONFIGURE YOUR INSTANCE TO USE THE AMAZON TIME SYNC SERVICE

 1. Connect to your instance and uninstall the NTP service.
    
    [ec2-user ~]$ sudo yum erase 'ntp*'

 2. Install the chrony package.
    
    [ec2-user ~]$ sudo yum install chrony

 3. Open the /etc/chrony.conf file using a text editor (such as vim or nano).
    Verify that the file includes the following line:
    
    server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4
    
    If the line is present, then the Amazon Time Sync Service is already
    configured and you can go to the next step. If not, add the line after any
    other server or pool statements that are already present in the file, and
    save your changes.

 4. Restart the chrony daemon (chronyd).
    
    [ec2-user ~]$ sudo service chronyd restart
    
    Starting chronyd:                                          [  OK  ]
    
    NOTE
    
    On RHEL and CentOS (up to version 6), the service name is chrony instead of
    chronyd.

 5. Use the chkconfig command to configure chronyd to start at each system boot.
    
    [ec2-user ~]$ sudo chkconfig chronyd on

 6. Verify that chrony is using the 169.254.169.123 IP address to synchronize
    the time.
    
    [ec2-user ~]$ chronyc sources -v
    
    210 Number of sources = 7
            
              .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
             / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
            | /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
            ||                                                 .- xxxx [ yyyy ] +/- zzzz
            ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
            ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
            ||                                \     |          |  zzzz = estimated error.
            ||                                 |    |           \
            MS Name/IP address         Stratum Poll Reach LastRx Last sample               
            ===============================================================================
            ^* 169.254.169.123               3   6    17    43    -30us[ -226us] +/-  287us
            ^- ec2-12-34-231-12.eu-west>     2   6    17    43   -388us[ -388us] +/-   11ms
            ^- tshirt.heanet.ie              1   6    17    44   +178us[  +25us] +/- 1959us
            ^? tbag.heanet.ie                0   6     0     -     +0ns[   +0ns] +/-    0ns
            ^? bray.walcz.net                0   6     0     -     +0ns[   +0ns] +/-    0ns
            ^? 2a05:d018:c43:e312:ce77:>     0   6     0     -     +0ns[   +0ns] +/-    0ns
            ^? 2a05:d018:dab:2701:b70:b>     0   6     0     -     +0ns[   +0ns] +/-    0ns
    
    In the output that's returned, ^* indicates the preferred time source.

 7. Verify the time synchronization metrics that are reported by chrony.
    
    [ec2-user ~]$ chronyc tracking
    
    Reference ID    : A9FEA97B (169.254.169.123)
            Stratum         : 4
            Ref time (UTC)  : Wed Nov 22 13:18:34 2017
            System time     : 0.000000626 seconds slow of NTP time
            Last offset     : +0.002852759 seconds
            RMS offset      : 0.002852759 seconds
            Frequency       : 1.187 ppm fast
            Residual freq   : +0.020 ppm
            Skew            : 24.388 ppm
            Root delay      : 0.000504752 seconds
            Root dispersion : 0.001112565 seconds
            Update interval : 64.4 seconds
            Leap status     : Normal


CONFIGURE THE AMAZON TIME SYNC SERVICE ON UBUNTU

You must edit the chrony configuration file to add a server entry for the Amazon
Time Sync Service.

TO CONFIGURE YOUR INSTANCE TO USE THE AMAZON TIME SYNC SERVICE

 1. Connect to your instance and use apt to install the chrony package.
    
    ubuntu:~$ sudo apt install chrony
    
    NOTE
    
    If necessary, update your instance first by running sudo apt update.

 2. Open the /etc/chrony/chrony.conf file using a text editor (such as vim or
    nano). Add the following line before any other server or pool statements
    that are already present in the file, and save your changes:
    
    server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4

 3. Restart the chrony service.
    
    ubuntu:~$ sudo /etc/init.d/chrony restart
    
    Restarting chrony (via systemctl): chrony.service.

 4. Verify that chrony is using the 169.254.169.123 IP address to synchronize
    the time.
    
    ubuntu:~$ chronyc sources -v
    
    210 Number of sources = 7
                
                  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
                 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
                | /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
                ||                                                 .- xxxx [ yyyy ] +/- zzzz
                ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
                ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
                ||                                \     |          |  zzzz = estimated error.
                ||                                 |    |           \
                MS Name/IP address         Stratum Poll Reach LastRx Last sample
                ===============================================================================
                ^* 169.254.169.123               3   6    17    12    +15us[  +57us] +/-  320us
                ^- tbag.heanet.ie                1   6    17    13  -3488us[-3446us] +/- 1779us
                ^- ec2-12-34-231-12.eu-west-     2   6    17    13   +893us[ +935us] +/- 7710us
                ^? 2a05:d018:c43:e312:ce77:6     0   6     0   10y     +0ns[   +0ns] +/-    0ns
                ^? 2a05:d018:d34:9000:d8c6:5     0   6     0   10y     +0ns[   +0ns] +/-    0ns
                ^? tshirt.heanet.ie              0   6     0   10y     +0ns[   +0ns] +/-    0ns
                ^? bray.walcz.net                0   6     0   10y     +0ns[   +0ns] +/-    0ns
    
    In the output that's returned, on the line starting with ^* indicates the
    preferred time source.

 5. Verify the time synchronization metrics that are reported by chrony.
    
    ubuntu:~$ chronyc tracking
    
    Reference ID    : 169.254.169.123 (169.254.169.123)
                Stratum         : 4
                Ref time (UTC)  : Wed Nov 29 07:41:57 2017
                System time     : 0.000000011 seconds slow of NTP time
                Last offset     : +0.000041659 seconds
                RMS offset      : 0.000041659 seconds
                Frequency       : 10.141 ppm slow
                Residual freq   : +7.557 ppm
                Skew            : 2.329 ppm
                Root delay      : 0.000544 seconds
                Root dispersion : 0.000631 seconds
                Update interval : 2.0 seconds
                Leap status     : Normal


CONFIGURE THE AMAZON TIME SYNC SERVICE ON SUSE LINUX

Install chrony from https://software.opensuse.org/package/chrony.

Open the /etc/chrony.conf file using a text editor (such as vim or nano). Verify
that the file contains the following line:

server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4

If this line is not present, add it. Comment out any other server or pool lines.
Open yaST and enable the chrony service.


CONFIGURE THE TIME FOR EC2 INSTANCES WITH IPV6 ADDRESSES

This section explains how the process described in Configure the time for EC2
instances with IPv4 addresses differs if you are configuring Amazon Time Sync
Service for EC2 instances that use an IPv6 address. It doesn't explain the
entire Amazon Time Sync Service configuration process. The IPv6 address is only
accessible on Instances built on the Nitro System.

NOTE

We don't recommend using both the IPv4 address and the IPv6 address entries
together in your chrony.conf file. The IPv4 and IPv6 NTP packets come from the
same local server for your instance. You will likely get mixed results with some
packets coming from the IPv4 endpoint and some from the IPv6 endpoint if you are
using both at the same time.

Depending on the Linux distribution you are using, when you reach the step to
edit the chrony.conf file, you'll be using the IPv6 endpoint of the Amazon Time
Sync Service (fd00:ec2::123) rather than the IPv4 endpoint (169.254.169.123):

server fd00:ec2::123 prefer iburst minpoll 4 maxpoll 4

Save the file and verify that chrony is using the fd00:ec2::123 IPv6 address to
synchronize time:

[ec2-user ~]$ chronyc sources -v

In the output, if you see the fd00:ec2::123 IPv6 address, the configuration is
complete.


CHANGE THE TIME ZONE ON AMAZON LINUX

Amazon Linux instances are set to the UTC (Coordinated Universal Time) time zone
by default. You can change the time on an instance to the local time or to
another time zone in your network.

IMPORTANT

This information applies to Amazon Linux. For information about other
distributions, see their specific documentation.

TO CHANGE THE TIME ZONE ON AN AMAZON LINUX 2023 OR AMAZON LINUX 2 INSTANCE

 1. View the system's current time zone setting.
    
    [ec2-user ~]$ timedatectl

 2. List the available time zones.
    
    [ec2-user ~]$ timedatectl list-timezones

 3. Set the chosen time zone.
    
    [ec2-user ~]$ sudo timedatectl set-timezone America/Vancouver

 4. (Optional) Confirm that the current time zone is updated to the new time
    zone by running the timedatectl command again.
    
    [ec2-user ~]$ timedatectl

TO CHANGE THE TIME ZONE ON AN AMAZON LINUX INSTANCE

 1. Identify the time zone to use on the instance. The /usr/share/zoneinfo
    directory contains a hierarchy of time zone data files. Browse the directory
    structure at that location to find a file for your time zone.
    
    [ec2-user ~]$ ls /usr/share/zoneinfo
    Africa      Chile    GB         Indian       Mideast   posixrules  US
    America     CST6CDT  GB-Eire    Iran         MST       PRC         UTC
    Antarctica  Cuba     GMT        iso3166.tab  MST7MDT   PST8PDT     WET
    Arctic      EET      GMT0       Israel       Navajo    right       W-SU
    ...
    
    Some of the entries at this location are directories (such as America), and
    these directories contain time zone files for specific cities. Find your
    city (or a city in your time zone) to use for the instance.

 2. Update the /etc/sysconfig/clock file with the new time zone. In this
    example, we use the time zone data file for Los Angeles,
    /usr/share/zoneinfo/America/Los_Angeles.
    
    1. Open the /etc/sysconfig/clock file with your favorite text editor (such
       as vim or nano). You need to use sudo with your editor command because
       /etc/sysconfig/clock is owned by root.
       
       [ec2-user ~]$ sudo nano /etc/sysconfig/clock
    
    2. Locate the ZONE entry, and change it to the time zone file (omitting the
       /usr/share/zoneinfo section of the path). For example, to change to the
       Los Angeles time zone, change the ZONE entry to the following:
       
       ZONE="America/Los_Angeles"
       
       NOTE
       
       Do not change the UTC=true entry to another value. This entry is for the
       hardware clock, and does not need to be adjusted when you're setting a
       different time zone on your instance.
    
    3. Save the file and exit the text editor.

 3. Create a symbolic link between /etc/localtime and the time zone file so that
    the instance finds the time zone file when it references local time
    information.
    
    [ec2-user ~]$ sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

 4. Reboot the system to pick up the new time zone information in all services
    and applications.
    
    [ec2-user ~]$ sudo reboot

 5. (Optional) Confirm that the current time zone is updated to the new time
    zone by using the date command. The current time zone appears in the output.
    In the following example, the current time zone is PDT, which refers to the
    Los Angeles time zone.
    
    [ec2-user ~]$ date
    Sun Aug 16 05:45:16 PDT 2020


COMPARE TIMESTAMPS

If you're using the Amazon Time Sync Service, you can compare the timestamps on
your Amazon EC2 instances with ClockBound to determine the true time of an
event. ClockBound measures the clock accuracy of your EC2 instance, and allows
you to check if a given timestamp is in the past or future with respect to your
instance's current clock. This information is valuable for determining the order
and consistency of events and transactions across EC2 instances, independent of
each instance's geographic location.

ClockBound is an open source daemon and library. To learn more about ClockBound,
including installation instructions, see ClockBound on GitHub.

Javascript is disabled or is unavailable in your browser.

To use the Amazon Web Services Documentation, Javascript must be enabled. Please
refer to your browser's Help pages for instructions.

Document Conventions
I/O scheduler
Optimize CPU options
Did this page help you? - Yes

Thanks for letting us know we're doing a good job!

If you've got a moment, please tell us what we did right so we can do more of
it.



Did this page help you? - No

Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.




Did this page help you?
Yes
No
Provide feedback
Next topic:Optimize CPU options
Previous topic:I/O scheduler
Need help?
 * Try AWS re:Post 
 * Connect with an AWS IQ expert 

PrivacySite termsCookie preferences
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.


ON THIS PAGE

--------------------------------------------------------------------------------

 * Configure the time for clients with Amazon Time Sync Public NTP
 * Configure the time for EC2 instances with IPv4 addresses
 * Configure the time for EC2 instances with IPv6 addresses
 * Change the time zone on Amazon Linux
 * Compare timestamps





DID THIS PAGE HELP YOU? - NO



Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.




Feedback