|
| 1 | +# Specify the AWS CodeBuild Endpoint<a name="endpoint-specify"></a> |
| 2 | + |
| 3 | + You can use the AWS Command Line Interface \(AWS CLI\) or one of the AWS SDKs to specify the endpoint used by AWS CodeBuild\. There is an endpoint for each region in which AWS CodeBuild is available\. In addition to a regional endpoint, four regions also have a Federal Information Processing Standards \(FIPS\) endpoint\. For more information about FIPS endpoints, see [FIPS 140\-2 Overview](https://aws.amazon.com/compliance/fips/)\. |
| 4 | + |
| 5 | + Specifying an endpoint is optional\. If you don't explicitly tell AWS CodeBuild which endpoint to use, the service uses the endpoint associated with the region your AWS account uses\. AWS CodeBuild never defaults to a FIPS endpoint\. If you want to use a FIPS endpoint, you must associate AWS CodeBuild with it using one of the following methods\. |
| 6 | + |
| 7 | +**Note** |
| 8 | + You can use an alias or region name to specify an endpoint using an AWS SDK\. If you use the AWS CLI, then you must use the full endpoint name\. |
| 9 | + |
| 10 | + For endpoints that can be used with AWS CodeBuild, see [AWS CodeBuild Regions and Endpoints](http://docs.aws.amazon.com/general/latest/gr/rande.html#codebuild_region)\. |
| 11 | + |
| 12 | +**Topics** |
| 13 | ++ [Specify the AWS CodeBuild Endpoint \(AWS CLI\)](#endpoint-specify-cli) |
| 14 | ++ [Specify the AWS CodeBuild Endpoint \(AWS SDK\)](#endpoint-specify-sdk) |
| 15 | + |
| 16 | +## Specify the AWS CodeBuild Endpoint \(AWS CLI\)<a name="endpoint-specify-cli"></a> |
| 17 | + |
| 18 | + You can use the AWS CLI to specify the endpoint through which AWS CodeBuild is accessed by using the `--endpoint-url` argument in any AWS CodeBuild command\. For example, run this command to get a list of project build names using the Federal Information Processing Standards \(FIPS\) endpoint in the US East \(N\. Virginia\) Region: |
| 19 | + |
| 20 | +``` |
| 21 | +aws codebuild list-projects --endpoint-url https://codebuild-fips.us-east-1.amazonaws.com |
| 22 | +``` |
| 23 | + |
| 24 | +Include the `https://` at the begining of the endpoint\. |
| 25 | + |
| 26 | + The `--endpoint-url` AWS CLI argument is available to all AWS services\. For more information about this and other AWS CLI arguments, see [AWS CLI Command Reference](http://docs.aws.amazon.com/cli/latest/reference/)\. |
| 27 | + |
| 28 | +## Specify the AWS CodeBuild Endpoint \(AWS SDK\)<a name="endpoint-specify-sdk"></a> |
| 29 | + |
| 30 | + You can use an AWS SDK to specify the endpoint through which AWS CodeBuild is accessed\. Although this example uses the [AWS SDK for Java](https://aws.amazon.com/sdk-for-java/), you can specify the endpoint with the other AWS SDKs\. |
| 31 | + |
| 32 | + Use the `withEndpointConfiguration` method when constructing the AWSCodeBuild client\. Here is format to use: |
| 33 | + |
| 34 | +``` |
| 35 | +AWSCodeBuild awsCodeBuild = AWSCodeBuildClientBuilder.standard(). |
| 36 | + withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("endpoint", "region")). |
| 37 | + withCredentials(new AWSStaticCredentialsProvider(sessionCredentials)). |
| 38 | + build(); |
| 39 | +``` |
| 40 | + |
| 41 | + For information about `AWSCodeBuildClientBuilder`, see [Class AWSCodeBuildClientBuilder](http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/services/codebuild/AWSCodeBuildClientBuilder.html)\. |
| 42 | + |
| 43 | + The credentials used in `withCredentials` must be of type `AWSCredentialsProvider`\. For more information, see [Working with AWS Credentials](http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html)\. |
| 44 | + |
| 45 | + Do not include `https://` at the begining of the endpoint\. |
| 46 | + |
| 47 | + If you want to specify a non\-FIPS endpoint, you can use the region instead of the actual endpoint\. For example, to specify the endpoint in the US East \(N\. Virginia\) region, you can use `us-east-1` instead of the full endpoint name, `codebuild.us-east-1.amazonaws.com`\. |
| 48 | + |
| 49 | +If you want to specify a FIPS endpoint, you can use an alias to simplify your code\. Only FIPS endpoints have an alias\. Other endpoints must be specified using their region or full name\. |
| 50 | + |
| 51 | +The following table lists the alias for each of the four available FIPS endpoints: |
| 52 | + |
| 53 | + |
| 54 | +**** |
| 55 | +[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codebuild/latest/userguide/endpoint-specify.html) |
| 56 | + |
| 57 | + To specify use of the FIPS endpoint in the US West \(Oregon\) region using an alias: |
| 58 | + |
| 59 | +``` |
| 60 | +AWSCodeBuild awsCodeBuild = AWSCodeBuildClientBuilder.standard(). |
| 61 | + withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("us-west-2-fips", "us-west-2")). |
| 62 | + withCredentials(new AWSStaticCredentialsProvider(sessionCredentials)). |
| 63 | + build(); |
| 64 | +``` |
| 65 | + |
| 66 | + To specify use of the non\-FIPS endpoint in the US East \(N\. Virginia\) region: |
| 67 | + |
| 68 | +``` |
| 69 | +AWSCodeBuild awsCodeBuild = AWSCodeBuildClientBuilder.standard(). |
| 70 | + withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("us-east-1", "us-east-1")). |
| 71 | + withCredentials(new AWSStaticCredentialsProvider(sessionCredentials)). |
| 72 | + build(); |
| 73 | +``` |
| 74 | + |
| 75 | + To specify use of the non\-FIPS endpoint in the Asia Pacific \(Mumbai\) region: |
| 76 | + |
| 77 | +``` |
| 78 | +AWSCodeBuild awsCodeBuild = AWSCodeBuildClientBuilder.standard(). |
| 79 | + withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("ap-south-1", "ap-south-1")). |
| 80 | + withCredentials(new AWSStaticCredentialsProvider(sessionCredentials)). |
| 81 | + build(); |
| 82 | +``` |
0 commit comments