@Test
        public void s3TestOverBridgeNetwork() throws IOException {
            // with_aws_sdk_v1 {
            AmazonS3 s3 = AmazonS3ClientBuilder
                .standard()
                .withEndpointConfiguration(
                    new AwsClientBuilder.EndpointConfiguration(
                        localstack.getEndpoint().toString(),
                        localstack.getRegion()
                    )
                )
                .withCredentials(
                    new AWSStaticCredentialsProvider(
                        new BasicAWSCredentials(localstack.getAccessKey(), localstack.getSecretKey())
                    )
                )
                .build();
            // }

            final String bucketName = "foo";
            s3.createBucket(bucketName);
            s3.putObject(bucketName, "bar", "baz");

            final List<Bucket> buckets = s3.listBuckets();
            final Optional<Bucket> maybeBucket = buckets
                .stream()
                .filter(b -> b.getName().equals(bucketName))
                .findFirst();
            assertThat(maybeBucket).as("The created bucket is present").isPresent();
            final Bucket bucket = maybeBucket.get();

            assertThat(bucket.getName()).as("The created bucket has the right name").isEqualTo(bucketName);

            final ObjectListing objectListing = s3.listObjects(bucketName);
            assertThat(objectListing.getObjectSummaries()).as("The created bucket has 1 item in it").hasSize(1);

            final S3Object object = s3.getObject(bucketName, "bar");
            final String content = IOUtils.toString(object.getObjectContent(), StandardCharsets.UTF_8);
            assertThat(content).as("The object can be retrieved").isEqualTo("baz");
        }
Tests for Localstack Container, used both in bridge network (exposed to host) and docker network modes.
<p>
These tests attempt simple interactions with the container to verify behaviour. The bridge network tests use the
Java AWS SDK, whereas the docker network tests use an AWS CLI container within the network, to simulate usage of
Localstack from within a Docker network.
modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackContainerTest.java