pwd
id
whoami
df -h
nproc
free -h
aws --version
python3 --version
node --version
docker --version
kubectl version
echo $SHELL
which zsh pwsh
which aws cdk sam eb ecs-cli
git --version
java -version
aws configure list
aws sts get-caller-identity
aws ec2 describe-regions --output table
aws configure set region us-east-1
aws configure get region
pip3 list | grep boto3
node --version
npm --version
npm -g ls --depth 0 2>/dev/null | grep aws-sdk
docker --version
sam --version
cdk --version
which vim nano make wget curl tar zip unzip
ls /usr/share/bash-completion/completions/ | grep git
echo "source /usr/share/bash-completion/completions/git" >> ~/.bashrc
cat ~/.bashrc
echo "Available shells:"
echo "- Bash (default): $(bash --version | head -1)"
echo "- Z Shell: $(zsh --version)"
echo "- PowerShell: $(pwsh --version)"
aws s3 ls
aws ec2 describe-instances --output table
BUCKET_NAME="cloudshell-demo-$(date +%s)"
echo "Bucket name: $BUCKET_NAME"
aws s3 mb s3://$BUCKET_NAME
aws s3 ls
aws s3api put-bucket-versioning \
--bucket $BUCKET_NAME \
--versioning-configuration Status=Enabled
aws s3api get-bucket-versioning --bucket $BUCKET_NAME
echo "Hello from AWS CloudShell!" > hello-cloudshell.txt
echo "CloudShell Demo - $(date)" > timestamp.txt
aws s3 cp hello-cloudshell.txt s3://$BUCKET_NAME/
aws s3 cp timestamp.txt s3://$BUCKET_NAME/
aws s3 ls s3://$BUCKET_NAME/
mkdir demo-folder
echo "Content 1" > demo-folder/file1.txt
echo "Content 2" > demo-folder/file2.txt
aws s3 sync demo-folder/ s3://$BUCKET_NAME/demo-folder/
aws s3 ls s3://$BUCKET_NAME/demo-folder/
du -sh ~/
mkdir -p ~/projects/cloudshell-demo
cd ~/projects/cloudshell-demo
cat > config.json << 'EOF'
{
"environment": "demo",
"region": "us-east-1",
"services": {
"s3": {
"bucket_prefix": "cloudshell-demo"
},
"ec2": {
"instance_type": "t2.micro"
}
}
}
EOF
cat > deployment.yaml << 'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
name: cloudshell-demo
data:
environment: demo
created-by: cloudshell
timestamp: $(date)
EOF
~/projects/cloudshell-demo/config.json
echo "some test text" > test-text.txt
cp ~/test-text.txt .
cat test-text.txt
cat > ~/persistent-script.sh << 'EOF'
#!/bin/bash
echo "This script persists across CloudShell sessions!"
echo "CloudShell Environment Details:"
echo "- OS: Amazon Linux 2023"
echo "- CPU: 1 vCPU"
echo "- Memory: 2GB RAM"
echo "- Persistent Storage: 1GB in $HOME"
echo "Current session: $(date)"
aws sts get-caller-identity --output text --query 'UserId'
EOF
chmod +x ~/persistent-script.sh
./persistent-script.sh
ls -la
cat > ~/aws-resource-manager.sh << 'EOF'
#!/bin/bash
# AWS Resource Manager Script for CloudShell Demo
# This script demonstrates CloudShell automation capabilities
set -e # Exit on any error
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${GREEN}[INFO]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Main function
main() {
print_status "Starting AWS Resource Manager..."
# Get current AWS identity
print_status "Current AWS Identity:"
aws sts get-caller-identity
# List S3 buckets
print_status "Current S3 Buckets:"
aws s3 ls
# Check EC2 instances
print_status "EC2 Instances in current region:"
INSTANCES=$(aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType]' --output text)
if [ -z "$INSTANCES" ]; then
print_warning "No EC2 instances found in current region"
else
echo "$INSTANCES"
fi
print_status "Resource check completed successfully!"
}
# Execute main function
main "$@"
EOF
chmod +x ~/aws-resource-manager.sh
./aws-resource-manager.sh
history | tail -5
env | grep AWS
aws s3 rm s3://$BUCKET_NAME --recursive
BUCKET_NAME=
echo "Checking for object versions and delete markers..."
aws s3api list-object-versions --bucket $BUCKET_NAME
aws s3api delete-objects --bucket $BUCKET_NAME \
--delete "$(aws s3api list-object-versions --bucket $BUCKET_NAME \
--query '{Objects: Versions[].{Key: Key, VersionId: VersionId}}' \
--output json)" 2>/dev/null || echo "No object versions to delete"
aws s3api delete-objects --bucket $BUCKET_NAME \
--delete "$(aws s3api list-object-versions --bucket $BUCKET_NAME \
--query '{Objects: DeleteMarkers[].{Key: Key, VersionId: VersionId}}' \
--output json)" 2>/dev/null || echo "No delete markers to remove"
aws s3 rb s3://$BUCKET_NAME
aws s3 ls | grep $BUCKET_NAME || echo "Bucket successfully deleted"
ls -la ~/*.sh
rm -f hello-cloudshell.txt timestamp.txt downloaded-file.txt
rm -rf demo-folder/