1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. BucketAccessKey
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.lightsail.BucketAccessKey

Explore with Pulumi AI

Provides a lightsail bucket access key. This is a set of credentials that allow API requests to be made to the lightsail bucket.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const test = new aws.lightsail.Bucket("test", {
    name: "mytestbucket",
    bundleId: "small_1_0",
});
const testLightsailBucketAccessKeyAccessKey = new aws.index.LightsailBucketAccessKeyAccessKey("test", {bucketName: testAwsLightsailBucketAccessKey.id});
Copy
import pulumi
import pulumi_aws as aws

test = aws.lightsail.Bucket("test",
    name="mytestbucket",
    bundle_id="small_1_0")
test_lightsail_bucket_access_key_access_key = aws.index.LightsailBucketAccessKeyAccessKey("test", bucket_name=test_aws_lightsail_bucket_access_key.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := lightsail.NewBucket(ctx, "test", &lightsail.BucketArgs{
			Name:     pulumi.String("mytestbucket"),
			BundleId: pulumi.String("small_1_0"),
		})
		if err != nil {
			return err
		}
		_, err = aws.NewLightsailBucketAccessKeyAccessKey(ctx, "test", &aws.LightsailBucketAccessKeyAccessKeyArgs{
			BucketName: testAwsLightsailBucketAccessKey.Id,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var test = new Aws.LightSail.Bucket("test", new()
    {
        Name = "mytestbucket",
        BundleId = "small_1_0",
    });

    var testLightsailBucketAccessKeyAccessKey = new Aws.Index.LightsailBucketAccessKeyAccessKey("test", new()
    {
        BucketName = testAwsLightsailBucketAccessKey.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Bucket;
import com.pulumi.aws.lightsail.BucketArgs;
import com.pulumi.aws.lightsailBucketAccessKeyAccessKey;
import com.pulumi.aws.lightsailBucketAccessKeyAccessKeyArgs;
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 test = new Bucket("test", BucketArgs.builder()
            .name("mytestbucket")
            .bundleId("small_1_0")
            .build());

        var testLightsailBucketAccessKeyAccessKey = new LightsailBucketAccessKeyAccessKey("testLightsailBucketAccessKeyAccessKey", LightsailBucketAccessKeyAccessKeyArgs.builder()
            .bucketName(testAwsLightsailBucketAccessKey.id())
            .build());

    }
}
Copy
resources:
  test:
    type: aws:lightsail:Bucket
    properties:
      name: mytestbucket
      bundleId: small_1_0
  testLightsailBucketAccessKeyAccessKey:
    type: aws:lightsailBucketAccessKeyAccessKey
    name: test
    properties:
      bucketName: ${testAwsLightsailBucketAccessKey.id}
Copy

Create BucketAccessKey Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new BucketAccessKey(name: string, args: BucketAccessKeyArgs, opts?: CustomResourceOptions);
@overload
def BucketAccessKey(resource_name: str,
                    args: BucketAccessKeyArgs,
                    opts: Optional[ResourceOptions] = None)

@overload
def BucketAccessKey(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    bucket_name: Optional[str] = None)
func NewBucketAccessKey(ctx *Context, name string, args BucketAccessKeyArgs, opts ...ResourceOption) (*BucketAccessKey, error)
public BucketAccessKey(string name, BucketAccessKeyArgs args, CustomResourceOptions? opts = null)
public BucketAccessKey(String name, BucketAccessKeyArgs args)
public BucketAccessKey(String name, BucketAccessKeyArgs args, CustomResourceOptions options)
type: aws:lightsail:BucketAccessKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. BucketAccessKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. BucketAccessKeyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. BucketAccessKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. BucketAccessKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. BucketAccessKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var bucketAccessKeyResource = new Aws.LightSail.BucketAccessKey("bucketAccessKeyResource", new()
{
    BucketName = "string",
});
Copy
example, err := lightsail.NewBucketAccessKey(ctx, "bucketAccessKeyResource", &lightsail.BucketAccessKeyArgs{
	BucketName: pulumi.String("string"),
})
Copy
var bucketAccessKeyResource = new BucketAccessKey("bucketAccessKeyResource", BucketAccessKeyArgs.builder()
    .bucketName("string")
    .build());
Copy
bucket_access_key_resource = aws.lightsail.BucketAccessKey("bucketAccessKeyResource", bucket_name="string")
Copy
const bucketAccessKeyResource = new aws.lightsail.BucketAccessKey("bucketAccessKeyResource", {bucketName: "string"});
Copy
type: aws:lightsail:BucketAccessKey
properties:
    bucketName: string
Copy

BucketAccessKey Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The BucketAccessKey resource accepts the following input properties:

BucketName
This property is required.
Changes to this property will trigger replacement.
string
The name of the bucket that the new access key will belong to, and grant access to.
BucketName
This property is required.
Changes to this property will trigger replacement.
string
The name of the bucket that the new access key will belong to, and grant access to.
bucketName
This property is required.
Changes to this property will trigger replacement.
String
The name of the bucket that the new access key will belong to, and grant access to.
bucketName
This property is required.
Changes to this property will trigger replacement.
string
The name of the bucket that the new access key will belong to, and grant access to.
bucket_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the bucket that the new access key will belong to, and grant access to.
bucketName
This property is required.
Changes to this property will trigger replacement.
String
The name of the bucket that the new access key will belong to, and grant access to.

Outputs

All input properties are implicitly available as output properties. Additionally, the BucketAccessKey resource produces the following output properties:

AccessKeyId string
The ID of the access key.
CreatedAt string
The timestamp when the access key was created.
Id string
The provider-assigned unique ID for this managed resource.
SecretAccessKey string
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
Status string
The status of the access key.
AccessKeyId string
The ID of the access key.
CreatedAt string
The timestamp when the access key was created.
Id string
The provider-assigned unique ID for this managed resource.
SecretAccessKey string
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
Status string
The status of the access key.
accessKeyId String
The ID of the access key.
createdAt String
The timestamp when the access key was created.
id String
The provider-assigned unique ID for this managed resource.
secretAccessKey String
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status String
The status of the access key.
accessKeyId string
The ID of the access key.
createdAt string
The timestamp when the access key was created.
id string
The provider-assigned unique ID for this managed resource.
secretAccessKey string
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status string
The status of the access key.
access_key_id str
The ID of the access key.
created_at str
The timestamp when the access key was created.
id str
The provider-assigned unique ID for this managed resource.
secret_access_key str
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status str
The status of the access key.
accessKeyId String
The ID of the access key.
createdAt String
The timestamp when the access key was created.
id String
The provider-assigned unique ID for this managed resource.
secretAccessKey String
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status String
The status of the access key.

Look up Existing BucketAccessKey Resource

Get an existing BucketAccessKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: BucketAccessKeyState, opts?: CustomResourceOptions): BucketAccessKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_key_id: Optional[str] = None,
        bucket_name: Optional[str] = None,
        created_at: Optional[str] = None,
        secret_access_key: Optional[str] = None,
        status: Optional[str] = None) -> BucketAccessKey
func GetBucketAccessKey(ctx *Context, name string, id IDInput, state *BucketAccessKeyState, opts ...ResourceOption) (*BucketAccessKey, error)
public static BucketAccessKey Get(string name, Input<string> id, BucketAccessKeyState? state, CustomResourceOptions? opts = null)
public static BucketAccessKey get(String name, Output<String> id, BucketAccessKeyState state, CustomResourceOptions options)
resources:  _:    type: aws:lightsail:BucketAccessKey    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccessKeyId string
The ID of the access key.
BucketName Changes to this property will trigger replacement. string
The name of the bucket that the new access key will belong to, and grant access to.
CreatedAt string
The timestamp when the access key was created.
SecretAccessKey string
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
Status string
The status of the access key.
AccessKeyId string
The ID of the access key.
BucketName Changes to this property will trigger replacement. string
The name of the bucket that the new access key will belong to, and grant access to.
CreatedAt string
The timestamp when the access key was created.
SecretAccessKey string
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
Status string
The status of the access key.
accessKeyId String
The ID of the access key.
bucketName Changes to this property will trigger replacement. String
The name of the bucket that the new access key will belong to, and grant access to.
createdAt String
The timestamp when the access key was created.
secretAccessKey String
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status String
The status of the access key.
accessKeyId string
The ID of the access key.
bucketName Changes to this property will trigger replacement. string
The name of the bucket that the new access key will belong to, and grant access to.
createdAt string
The timestamp when the access key was created.
secretAccessKey string
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status string
The status of the access key.
access_key_id str
The ID of the access key.
bucket_name Changes to this property will trigger replacement. str
The name of the bucket that the new access key will belong to, and grant access to.
created_at str
The timestamp when the access key was created.
secret_access_key str
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status str
The status of the access key.
accessKeyId String
The ID of the access key.
bucketName Changes to this property will trigger replacement. String
The name of the bucket that the new access key will belong to, and grant access to.
createdAt String
The timestamp when the access key was created.
secretAccessKey String
The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
status String
The status of the access key.

Import

Using pulumi import, import aws_lightsail_bucket_access_key using the id attribute. For example:

$ pulumi import aws:lightsail/bucketAccessKey:BucketAccessKey test example-bucket,AKIAIOSFODNN7EXAMPLE
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.