Access Key
Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.User;
import com.pulumi.aws.iam.UserArgs;
import com.pulumi.aws.iam.AccessKey;
import com.pulumi.aws.iam.AccessKeyArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.UserPolicy;
import com.pulumi.aws.iam.UserPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var lbUser = new User("lbUser", UserArgs.builder()
.path("/system/")
.build());
var lbAccessKey = new AccessKey("lbAccessKey", AccessKeyArgs.builder()
.user(lbUser.name())
.pgpKey("keybase:some_person_that_exists")
.build());
final var lbRoPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("ec2:Describe*")
.resources("*")
.build())
.build());
var lbRoUserPolicy = new UserPolicy("lbRoUserPolicy", UserPolicyArgs.builder()
.user(lbUser.name())
.policy(lbRoPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
ctx.export("secret", lbAccessKey.encryptedSecret());
}
}
Import
IAM Access Keys can be imported using the identifier, e.g.,
$ pulumi import aws:iam/accessKey:AccessKey example AKIA1234567890
Resource attributes such as encrypted_secret
, key_fingerprint
, pgp_key
, secret
, ses_smtp_password_v4
, and encrypted_ses_smtp_password_v4
are not available for imported resources as this information cannot be read from the IAM API.
Properties
Date and time in RFC3339 format that the access key was created.
Encrypted secret, base64 encoded, if pgp_key
was specified. This attribute is not available for imported resources. The encrypted secret may be decrypted using the command line.
Encrypted SES SMTP password, base64 encoded, if pgp_key
was specified. This attribute is not available for imported resources. The encrypted password may be decrypted using the command line.
Fingerprint of the PGP key used to encrypt the secret. This attribute is not available for imported resources.
Either a base-64 encoded PGP public key, or a keybase username in the form keybase:some_person_that_exists
, for use in the encrypted_secret
output attribute. If providing a base-64 encoded PGP public key, make sure to provide the "raw" version and not the "armored" one (e.g. avoid passing the -a
option to gpg --export
).
Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a pgp_key
instead, which will prevent the secret from being stored in plaintext, at the cost of preventing the use of the secret key in automation.
Secret access key converted into an SES SMTP password by applying AWS's documented Sigv4 conversion algorithm. This attribute is not available for imported resources. As SigV4 is region specific, valid Provider regions are ap-south-1
, ap-southeast-2
, eu-central-1
, eu-west-1
, us-east-1
and us-west-2
. See current AWS SES regions.