Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions pratik/s3/CDK
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// for installing

// npm install
// npm i -g aws-cdk

import * as cdk from 'aws-cdk-lib';
import { Bucket, BucketPolicy } from 'aws-cdk-lib/aws-s3';

{
"name": "my-package",
"version": "0.1.0",
"bin": {
"my-package": "bin/my-package.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk"
},
"devDependencies": {
"@types/jest": "^26.0.10",
"@types/node": "10.17.27",
"jest": "^26.4.2",
"ts-jest": "^26.2.0",
"aws-cdk": "2.16.0",
"ts-node": "^9.0.0",
"typescript": "~3.9.7"
},
"dependencies": {
"aws-cdk-lib": "2.16.0",
"constructs": "^10.0.0",
"source-map-support": "^0.5.16"
}
}
36 changes: 36 additions & 0 deletions pratik/s3/bash-scripts/all-scripts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//creating bucket
//these scripting files and the data related to the buckets will be stored in the /temp

aws s3api create-bucket --bucket $BUCKET_NAME //we can name the bucket after run

//deleting bucket

aws s3api delete-bucket --bucket $BUCKET_NAME //we can name bucket during the execution

//listing objects

aws s3api list-objects-v2 --bucket $BUCKET_NAME

/puting data into the file
#!/usr/bin/env bash
echo "== put-object"

# Check for bucket name
if [ -z "$1" ]; then
echo "There needs to be a bucket name eg. ./bucket my-bucket-name"
exit 1
fi

if [ -z "$2" ]; then
echo "There needs to be a filename eg. ./bucket my-bucket-name filename"
exit 1
fi
BUCKET_NAME=$1
FILENAME=$2

OBJECT_KEY=$(basename "$FILENAME")

aws s3api put-object \
--bucket $BUCKET_NAME \
--body $FILENAME \
--key $OBJECT_KEY
12 changes: 12 additions & 0 deletions pratik/s3/powershell/all-scripts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--create bucket

Import-Module AWS.Tools.s3api
$region = "us-east-1"

$bucketName = Read-Host Prompt 'Enter the S3 bucket name'

Write-Host "AWS Region : $region"
Write-Host "S3 Bucket: $bucketName"

New-S3Bucket -Bucketname $bucketName -Region $region

7 changes: 7 additions & 0 deletions s3/iac/cdk/lib/cdk-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ export class CdkStack extends Stack {
const bucket = new s3.Bucket(this, 'MyBucket');
}
}

export class CdkStack extends Stack {
constructor(scope: Construct, id: String, props?: StackProps) {
super(scope,id,props)
const bucket = new s3.Bucket(this, 'MyBucket')
}
}
3 changes: 2 additions & 1 deletion s3/iac/cfn/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ aws cloudformation deploy \
--template-file template.yaml \
--no-execute-changeset \
--region us-west-2 \
--stack-name $STACK_NAME
--stack-name $STACK_NAME

12 changes: 12 additions & 0 deletions s3/iac/cfn/deploy1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

echo "== deploy s3 bucket via CFN "

STACK_NAME="cfn-s3-simple"

aws cloudformation deploy \
--template-file template.yaml \
--no-execute-changeset \
--region us-west-2 \
--stack-name $STACK_NAME

3 changes: 3 additions & 0 deletions s3/iac/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ terraform {

provider "aws" {
# Configuration options
}

resource "aws_s3_bucket" "default" { }
}