@@ -0,0 +1,3025 @@
+//snippet-sourcedescription:%5BModifyDBInstance.java demonstrates how to modify a RDS instance.%5D%0A//snippet-keyword:%5BSDK for Java 2.0%5D%0A//snippet-keyword:%5BCode Sample%5D%0A//snippet-service:%5BAmazon Relational Database Service%5D%0A//snippet-sourcetype:%5Bfull-example%5D%0A//snippet-sourcedate:%5B7/6/2020%5D%0A//snippet-sourceauthor:%5Bscmacdon - aws%5D%0A%0A/*%0A   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A   This file is licensed under the Apache License, Version 2.0 (the %22License%22).%0A   You may not use this file except in compliance with the License. A copy of%0A   the License is located at%0A    http://aws.amazon.com/apache2.0/%0A   This file is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR%0A   CONDITIONS OF ANY KIND, either express or implied. See the License for the%0A   specific language governing permissions and limitations under the License.%0A*/%0A%0Apackage com.example.rds;%0A%0A// snippet-start:%5Brds.java2.modify_instance.import%5D%0Aimport software.amazon.awssdk.regions.Region;%0Aimport software.amazon.awssdk.services.rds.RdsClient;%0Aimport software.amazon.awssdk.services.rds.model.ModifyDbInstanceRequest;%0Aimport software.amazon.awssdk.services.rds.model.ModifyDbInstanceResponse;%0Aimport software.amazon.awssdk.services.rds.model.RdsException;%0A// snippet-end:%5Brds.java2.modify_instance.import%5D%0A%0A%0Apublic class ModifyDBInstance %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        final String USAGE = %22%5Cn%22 +%0A                %22Usage:%5Cn%22 +%0A                %22    ModifyDBInstance %3CdbInstanceIdentifier%3E%3CdbSnapshotIdentifier%3E %5Cn%5Cn%22 +%0A                %22Where:%5Cn%22 +%0A                %22    dbInstanceIdentifier - the database instance identifier %5Cn%22 +%0A                %22    masterUserPassword - the updated password that corresponds to the master user name %5Cn%22;%0A%0A        if (args.length %3C 3) %7B%0A            System.out.println(USAGE);%0A            System.exit(1);%0A        %7D%0A%0A        String dbInstanceIdentifier = args%5B0%5D;%0A        String masterUserPassword = args%5B1%5D;%0A%0A        Region region = Region.US_WEST_2;%0A        RdsClient rdsClient = RdsClient.builder()%0A                .region(region)%0A                .build();%0A%0A        updateIntance(rdsClient, dbInstanceIdentifier, masterUserPassword);%0A    %7D%0A%0A    public static void updateIntance(RdsClient rdsClient, String dbInstanceIdentifier, String masterUserPassword) %7B%0A%0A        try %7B%0A            // For a demo - modify the DB instance by modifying the master password%0A            ModifyDbInstanceRequest modifyDbInstanceRequest = ModifyDbInstanceRequest.builder()%0A                    .dbInstanceIdentifier(dbInstanceIdentifier)%0A                    .masterUserPassword(masterUserPassword)%0A                    .build();%0A%0A            ModifyDbInstanceResponse instanceResponse = rdsClient.modifyDBInstance(modifyDbInstanceRequest);%0A            System.out.print(%22The ARN of the modified database is: %22 +instanceResponse.dbInstance().dbInstanceArn());%0A%0A        %7D catch (RdsException e) %7B%0A            System.out.println(e.getLocalizedMessage());%0A            System.exit(1);%0A        %7D%0A%0A    %7D%0A%7D%0A%0A

Create ModifyDBInstance.java