AccessKeyProps Struct
Properties for defining an IAM access key.
| Source | aws-iam/lib/access-key.ts |
|---|---|
| Type last changed |
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,
});
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.