Learn how to authenticate with Infisical for EC2 instances, Lambda functions, and other IAM principals.
/api/v1/auth/aws-auth/login
endpoint. If successful,
then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
To be more specific:
GetCallerIdentity
query using the AWS Signature v4 algorithm; this is done using the credentials from the AWS environment where the IAM principal is running./api/v1/auth/aws-auth/login
endpoint.GetCallerIdentity
query
construction for you.Also, note that Infisical needs network-level access to send requests to the AWS STS API
as part of the AWS Auth workflow.Creating an identity
arn:aws:iam::123456789012:user/MyUserName
, arn:aws:iam::123456789012:role/MyRoleName
, or arn:aws:iam::123456789012:*
. Using a wildcard in this case allows any IAM principal in the account 123456789012
to authenticate with Infisical under the identity.https://sts.amazonaws.com/
): The endpoint URL for the AWS STS API. This value should be adjusted based on the AWS region you are operating in (e.g. https://sts.us-east-1.amazonaws.com/
); refer to the list of regional STS endpoints here.2592000
equivalent to 30 days): The lifetime for an acccess token in seconds. This value will be referenced at renewal time.2592000
equivalent to 30 days): The maximum lifetime for an acccess token in seconds. This value will be referenced at renewal time.0
): The maximum number of times that an access token can be used; a value of 0
implies infinite number of uses.0.0.0.0/0
, allowing usage from any network address.Adding an identity to a project
Accessing the Infisical API with the identity
GetCallerIdentity
query using the AWS Signature v4 algorithm and make a request to the /api/v1/auth/aws-auth/login
endpoint containing the query data
in exchange for an access token.We provide a few code examples below of how you can authenticate with Infisical from inside a Lambda function, EC2 instance, etc. and obtain an access token to access the Infisical API.Sample code for inside a Lambda function
Sample code for inside an EC2 instance
Sample code for general query construction
GetCallerIdentity
query and obtain the required payload components.The shown example uses Node.js but you can use any language you wish.<identityId>
with the ID of the identity you created in step 1.GetCallerIdentity
query construction for you.7200
seconds which can be adjusted.If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
a new access token should be obtained by performing another login operation.