Skip to content
v2.278.0

AccessKeyProps Struct ​

Properties for defining an IAM access key.

Example ​

ts
// Creates a new IAM user, access and secret keys, and stores the secret access key in a Secret.
const user = new iam.User(this, 'User');
const accessKey = new iam.AccessKey(this, 'AccessKey', { user });
const secret = new secretsmanager.Secret(this, 'Secret', {
	secretStringValue: accessKey.secretAccessKey,
});
python
# Creates a new IAM user, access and secret keys, and stores the secret access key in a Secret.
user = iam.User(self, "User")
access_key = iam.AccessKey(self, "AccessKey", user=user)
secret = secretsmanager.Secret(self, "Secret",
    secret_string_value=access_key.secret_access_key
)
java
// Creates a new IAM user, access and secret keys, and stores the secret access key in a Secret.
User user = new User(this, "User");
AccessKey accessKey = AccessKey.Builder.create(this, "AccessKey").user(user).build();
Secret secret = Secret.Builder.create(this, "Secret")
        .secretStringValue(accessKey.getSecretAccessKey())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Creates a new IAM user, access and secret keys, and stores the secret access key in a Secret.
var user = new User(this, "User");
var accessKey = new AccessKey(this, "AccessKey", new AccessKeyProps { User = user });
var secret = new Secret(this, "Secret", new SecretProps {
    SecretStringValue = accessKey.SecretAccessKey
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Creates a new IAM user, access and secret keys, and stores the secret access key in a Secret.
user := iam.NewUser(this, jsii.String("User"))
accessKey := iam.NewAccessKey(this, jsii.String("AccessKey"), &AccessKeyProps{
	User: User,
})
secret := secretsmanager.NewSecret(this, jsii.String("Secret"), &SecretProps{
	SecretStringValue: accessKey.SecretAccessKey,
})

Properties ​

serialoptionalnumberserialoptionalint | floatserialoptionalNumberSerialoptionaldoubleSerialoptional*float64 #
A CloudFormation-specific value that signifies the access key should be replaced/rotated.

Default: No serial value

This value can only be incremented. Incrementing this value will cause CloudFormation to replace the Access Key resource.

statusoptionalAccessKeyStatusstatusoptionalAccessKeyStatusstatusoptionalAccessKeyStatusStatusoptionalAccessKeyStatusStatusoptionalAccessKeyStatus #
The status of the access key.

Default: The access key is active

An Active access key is allowed to be used to make API calls; An Inactive key cannot.

userIUseruserIUseruserIUserUserIUserUserIUser required #
The IAM user this key will belong to.

Changing this value will result in the access key being deleted and a new access key (with a different ID and secret value) being assigned to the new user.