Screenplay Command Overview
The screenplay command offers a robust solution for orchestrating complex AWS workflows, including resource creation, task execution on remote instances, and environment configuration. It supports a wide range of operations, from provisioning EC2 instances and S3 buckets to injecting SSH keys and managing configurations, all with flexible and user-friendly options.
New Features and Enhancements
1. Script Execution
- Execute tasks on remote instances listed in /etc/hosts with specified commands.
- Inject SSH keys into new EC2 instances using
--create-remote (--cr)
. - Save instance IPs and names to /etc/hosts with
--add-remote (--ar)
.
2. AWS Resource Creation
Create various AWS resources, including:
- VPCs: Region-specific configurations.
- Subnets: Public IPs, custom tags.
- Internet Gateways, Route Tables, NAT Gateways: Networking setup.
- EC2 Instances: Tagging, security groups, user data.
- Security Groups: Customizable rules.
- EKS Clusters and Node Groups: Container orchestration.
- S3 Buckets: Lifecycle policies, versioning, logging.
- RDS Instances: Database setup.
- CodeBuild Projects: CI/CD pipelines.
- DynamoDB Tables: Throughput configurations.
- SSL Certificates, Transit Gateways, Elastic IPs, Load Balancers.
3. Configuration and Overrides
- Alternate variable files (
--ver, --rv
) and environments (--environment, -e
). - Override variables directly via
--set (-s)
. - Validate/lint variables using
--required-keys-file (--rk)
.
4. Resource Outputs and Metrics
- Capture and store resource outputs (e.g., VPC IDs, EC2 Instance IDs).
- Add instance details to metrics files using
--add-remote-metrics (--arm)
.
5. Task and Workflow Management
- Support for actions like RUN, CREATE, INSTALL, DEPLOYMENT, and PIPELINE.
- Conditional execution with
when
and dependencies withdepends_on
. - Parallel execution and loop configurations (
for_each, count
).
6. Enhanced Deployment and Notifications
- Multiple deployment strategies: S3, Docker Hub, Blue-Green deployment.
- Notifications via email/Slack on task completion or failure.
7. State Management and Security
- Maintain state with unique execution IDs and encrypted state files.
- Debugging support with sensitive variable decryption (
--password, --show
).
8. Destruction of Resources
Destroy resources via destroy
command with priority-based deletion:
- EC2 Instances → NAT Gateways → VPCs → Load Balancers → S3 Buckets, etc.
- Includes dedicated wait functions for dependent resource deletion.
Strengths
- Encryption/Decryption: Secure data handling with key-based and password-protected encryption.
- Validation and Linting: Robust checks for required keys and variable integrity.
- Error Handling and Logging: Detailed logs and comprehensive error messages.
- AWS Integration: Efficient resource creation and deletion with dependency management.
Usage Examples
# Execute tasks on remote instances
aws screenplay --create-remote --add-remote --command "sudo apt-get update"
# Create AWS resources
aws screenplay --resource vpc,ec2,s3 --environment dev --set key=value
# Destroy resources for a specific execution ID
aws destroy --ignore-yml
This updated command ensures a streamlined and efficient way to manage AWS workflows while providing extensive configuration and automation capabilities.
Watch the Installation Video
Watch the video below to see the AWS EC2 Creation process in action: