<a id="cli-aws-sts-get-certificate"></a>

# get-certificate

## Description

Returns an X.509 SPIFFE Verifiable Identity Document (X509-SVID) for the workload identity of the calling session. Your workload can use the certificate to prove its identity to peers, for example in mutual TLS (mTLS). The X.509 signer of the workload identity provider that issued the workload identity of the session signs the certificate in the Amazon Web Services Region that you send the request to.

You can call `GetCertificate` only with temporary credentials for a role session that has a workload identity, and the workload identity provider must use the SPIFFE naming scheme. You can’t call it with long-term IAM user credentials or with federated user credentials from  GetFederationToken . Amazon Web Services STS denies the request if the calling session doesn’t have a workload identity. Amazon Web Services STS also denies the request if the workload identity template or provider of the session no longer exists.

Amazon Web Services STS takes the identity in the certificate from the calling session, not from the request. Amazon Web Services STS uses only the public key from the certificate signing request (CSR) that you provide. The certificate chain in the response can include the root certificate authority (CA) certificate, so don’t use it as a source of trust anchors. To verify certificates that Amazon Web Services STS issues, get trust anchors only from  GetTrustBundles .

To call `GetCertificate` , you must have permission for the `sts:GetCertificate` action. Because Amazon Web Services STS issues the certificate on your behalf, you must also have permission for the `acm-pca:IssueCertificate` and `acm-pca:GetCertificate` actions on the certificate authority (CA) that the signer of the workload identity provider uses.

Amazon Web Services STS returns some errors from Amazon Web Services Private CA to you. If Amazon Web Services Private CA denies the request, the request fails with an access denied error. Check your permissions on the CA. If the account that owns the CA has exceeded its Amazon Web Services Private CA quota for issuing certificates, the request fails with a throttling error. Check the quotas for Amazon Web Services Private CA in that account.

#### NOTE
The `GetCertificate` API is not available on the STS global endpoint. Send requests to an STS endpoint in an Amazon Web Services Region.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCertificate)

## Synopsis

```
  get-certificate
--certificate-signing-request <value>
[--max-duration-seconds <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]
```

## Options

`--certificate-signing-request` (string) [required]

> A PEM-encoded PKCS #10 certificate signing request (CSR) that contains the public key for the certificate. The CSR must be signed with the matching private key.

> Amazon Web Services STS uses only the public key from the CSR. Amazon Web Services STS ignores the subject, subject alternative names (SANs), and requested extensions in the CSR. The signing algorithm of the certificate is set by the signer of the workload identity provider, not by the CSR.

> The CSR can be up to 32,768 characters long. If the CSR is blank, can’t be parsed, has a signature that doesn’t verify, or uses a key type or key size that the signer doesn’t support, the request fails with `MalformedCertificateSigningRequestException` .

> Constraints:

> * min: `1`
> * max: `32768`
> * pattern: `[\u0009\u000A\u000D\u0020-\u00FF]+`

`--max-duration-seconds` (integer)

> The time, in seconds, that the certificate is valid. The value can range from 3,600 seconds (1 hour) to 43,200 seconds (12 hours). If you don’t specify a value, the certificate is valid for 43,200 seconds (12 hours).

> The expiration of the calling session doesn’t limit this value. The certificate can remain valid after the session that requested it expires. This differs from `GetWebIdentityToken` , which rejects a token duration that ends after the calling session expires.

> Constraints:

> * min: `3600`
> * max: `43200`

`--cli-input-json` | `--cli-input-yaml` (string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by `--generate-cli-skeleton`. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with `--cli-input-yaml`.

`--generate-cli-skeleton` (string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value `input`, prints a sample input JSON that can be used as an argument for `--cli-input-json`. Similarly, if provided `yaml-input` it will print a sample input YAML that can be used with `--cli-input-yaml`. If provided with the value `output`, it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.

## Global Options

`--debug` (boolean)

Turn on debug logging.

`--endpoint-url` (string)

Override command’s default URL with the given URL.

`--no-verify-ssl` (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

`--no-paginate` (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

`--output` (string)

The formatting style for command output.

* json
* text
* table
* yaml
* yaml-stream
* off

`--query` (string)

A JMESPath query to use in filtering the response data.

`--profile` (string)

Use a specific profile from your credential file.

`--region` (string)

The region to use. Overrides config/env settings.

`--version` (string)

Display the version of this tool.

`--color` (string)

Turn on/off color output.

* on
* off
* auto

`--no-sign-request` (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

`--ca-bundle` (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

`--cli-read-timeout` (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

`--cli-connect-timeout` (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

`--cli-binary-format` (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob `fileb://` will always be treated as binary and use the file contents directly regardless of the `cli-binary-format` setting. When using `file://` the file contents will need to properly formatted for the configured `cli-binary-format`.

* base64
* raw-in-base64-out

`--no-cli-pager` (boolean)

Disable cli pager for output.

`--cli-auto-prompt` (boolean)

Automatically prompt for CLI input parameters.

`--no-cli-auto-prompt` (boolean)

Disable automatically prompt for CLI input parameters.

`--cli-error-format` (string)

The formatting style for error output. By default, errors are displayed in enhanced format.

* legacy
* json
* yaml
* text
* table
* enhanced

`--help` (boolean)

Display help for the command/subcommand.

## Output

Certificate -> (string)

> The issued X.509 certificate (X509-SVID), PEM-encoded. The certificate has an empty subject distinguished name (DN) and one URI subject alternative name (SAN) that contains the SPIFFE ID of the workload. You can use the certificate for both client and server authentication.

CertificateChain -> (string)

> The PEM-encoded certificate chain that links the certificate to the root certificate authority (CA), in the same format that Amazon Web Services Private CA returns. The chain can include the root CA certificate. Don’t use the chain as a source of trust anchors. To get the trust anchors for the provider, call  GetTrustBundles .

NotBefore -> (timestamp)

> The date and time, in UTC, when the certificate becomes valid. To allow for differences between clocks, Amazon Web Services STS sets this to five minutes before it issues the certificate.

NotAfter -> (timestamp)

> The date and time, in UTC, when the certificate expires. This is `MaxDurationSeconds` after Amazon Web Services STS issued the certificate, or 12 hours if you didn’t specify `MaxDurationSeconds` .

Subject -> (string)

> The SPIFFE ID of the workload, for example `spiffe://example.org/payments/checkout` . This is the same value as the URI subject alternative name (SAN) of the certificate, and comes from the calling session.
